Project

General

Profile

1
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,g=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=r||n||i,w=x&&(r?document.documentMode||6:+(i||n)[1]),b=!i&&/WebKit\//.test(e),o=b&&/Qt\/\d+\.\d+/.test(e),l=!i&&/Chrome\//.test(e),m=/Opera\//.test(e),a=/Apple Computer/.test(navigator.vendor),s=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),u=/PhantomJS/.test(e),c=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),h=/Android/.test(e),d=c||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),k=c||/Mac/.test(t),f=/\bCrOS\b/.test(e),p=/win/i.test(t),v=m&&e.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&15<=v&&(b=!(m=!1));var y=k&&(o||m&&(null==v||v<12.11)),_=g||x&&9<=w;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,L=function(e,t){var r=e.className,n=C(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function M(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function T(e,t){return M(e).appendChild(t)}function D(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"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 A(e,t,r,n){var i=D(e,t,r,n);return i.setAttribute("role","presentation"),i}function F(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function O(){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 N(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function E(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!C(r[n]).test(t)&&(t+=" "+r[n]);return t}S=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var q=function(e){e.select()};function z(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function W(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function P(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||t<=s)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}c?q=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(q=function(e){try{e.select()}catch(e){}});var H=function(){this.id=null};function I(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}H.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var R=30,B={toString:function(){return"CodeMirror.Pass"}},$={scroll:!1},j={origin:"*mouse"},U={origin:"+move"};function V(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||t<=i+l)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,t<=(i+=r-i%r))return n}}var G=[""];function K(e){for(;G.length<=e;)G.push(Z(G)+" ");return G[e]}function Z(e){return e[e.length-1]}function X(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Y(){}function Q(e,t){var r;return r=Object.create?Object.create(e):(Y.prototype=e,new Y),t&&W(t,r),r}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return 768<=e.charCodeAt(0)&&ne.test(e)}function oe(e,t,r){for(;(r<0?0<t:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=r<t?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t,r){var n=this;this.input=r,n.scrollbarFiller=D("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=D("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=A("div",null,"CodeMirror-code"),n.selectionDiv=D("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=D("div",null,"CodeMirror-cursors"),n.measure=D("div",null,"CodeMirror-measure"),n.lineMeasure=D("div",null,"CodeMirror-measure"),n.lineSpace=A("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var i=A("div",[n.lineSpace],"CodeMirror-lines");n.mover=D("div",[i],null,"position: relative"),n.sizer=D("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=D("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),n.gutters=D("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=D("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=D("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),x&&w<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),b||g&&d||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function ae(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function ue(e,r,n){var i=[],o=r.line;return e.iter(r.line,n.line+1,function(e){var t=e.text;o==n.line&&(t=t.slice(0,n.ch)),o==r.line&&(t=t.slice(r.ch)),i.push(t),++o}),i}function ce(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function he(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function de(e){if(null==e.parent)return null;for(var t=e.parent,r=I(t.lines,e),n=t.parent;n;n=(t=n).parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function fe(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function pe(e,t){return t>=e.first&&t<e.first+e.size}function ge(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function me(e,t,r){if(void 0===r&&(r=null),!(this instanceof me))return new me(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ve(e,t){return e.line-t.line||e.ch-t.ch}function ye(e,t){return e.sticky==t.sticky&&0==ve(e,t)}function be(e){return me(e.line,e.ch)}function ke(e,t){return ve(e,t)<0?t:e}function xe(e,t){return ve(e,t)<0?e:t}function we(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function _e(e,t){if(t.line<e.first)return me(e.first,0);var r,n,i,o=e.first+e.size-1;return t.line>o?me(o,ae(e,o).text.length):(n=ae(e,(r=t).line).text.length,null==(i=r.ch)||n<i?me(r.line,n):i<0?me(r.line,0):r)}function Ce(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=_e(e,t[n]);return r}var Se=!1,Le=!1;function Me(e,t,r){this.marker=e,this.from=t,this.to=r}function Te(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Ae(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function De(e,t){if(t.full)return null;var r=pe(e,t.from.line)&&ae(e,t.from.line).markedSpans,n=pe(e,t.to.line)&&ae(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==ve(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Me(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Me(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),u=1==t.text.length,c=Z(t.text).length+(u?i:0);if(s)for(var h=0;h<s.length;++h){var d=s[h];if(null==d.to){var f=Te(a,d.marker);f?u&&(d.to=null==f.to?null:f.to+c):d.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=c),null==g.from)Te(s,g.marker)||(g.from=c,u&&(s||(s=[])).push(g));else g.from+=c,u&&(s||(s=[])).push(g)}s&&(s=Fe(s)),a&&a!=s&&(a=Fe(a));var m=[s];if(!u){var v,y=t.text.length-2;if(0<y&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(v||(v=[])).push(new Me(s[b].marker,null,null));for(var k=0;k<y;++k)m.push(v);m.push(a)}return m}function Fe(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Oe(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Ne(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Ee(e){return e.inclusiveLeft?-1:0}function qe(e){return e.inclusiveRight?1:0}function ze(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=ve(n.from,i.from)||Ee(e)-Ee(t);if(o)return-o;var l=ve(n.to,i.to)||qe(e)-qe(t);return l||t.id-e.id}function We(e,t){var r,n=Le&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||ze(r,i.marker)<0)&&(r=i.marker);return r}function Pe(e){return We(e,!0)}function He(e){return We(e,!1)}function Ie(e,t){var r,n=Le&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||ze(r,o.marker)<0)&&(r=o.marker)}return r}function Re(e,t,r,n,i){var o=ae(e,t),l=Le&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=ve(u.from,r)||Ee(a.marker)-Ee(i),h=ve(u.to,n)||qe(a.marker)-qe(i);if(!(0<=c&&h<=0||c<=0&&0<=h)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?0<=ve(u.to,r):0<ve(u.to,r))||0<=c&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(u.from,n)<=0:ve(u.from,n)<0)))return!0}}}function Be(e){for(var t;t=Pe(e);)e=t.find(-1,!0).line;return e}function $e(e,t){var r=ae(e,t),n=Be(r);return r==n?t:de(n)}function je(e,t){if(t>e.lastLine())return t;var r,n=ae(e,t);if(!Ue(e,n))return t;for(;r=He(n);)n=r.find(1,!0).line;return de(n)+1}function Ue(e,t){var r=Le&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ve(e,t,n))return!0}}function Ve(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Ve(e,n.line,Te(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ve(e,t,i))return!0}function Ge(e){for(var t=0,r=(e=Be(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function Ke(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Pe(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=He(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Ze(e){var r=e.display,t=e.doc;r.maxLine=ae(t,t.first),r.maxLineLength=Ke(r.maxLine),r.maxLineChanged=!0,t.iter(function(e){var t=Ke(e);t>r.maxLineLength&&(r.maxLineLength=t,r.maxLine=e)})}var Xe=null;function Ye(e,t,r){var n;Xe=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"==r?n=i:Xe=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:Xe=i)}return null!=n?n:Xe}var Qe=function(){var W="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",P="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var H=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,I=/[stwN]/,R=/[LRr]/,B=/[Lb1n]/,$=/[1n]/;function j(e,t,r){this.level=e,this.from=t,this.to=r}return function(e,t){var r="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!H.test(e))return!1;for(var n,i=e.length,o=[],l=0;l<i;++l)o.push((n=e.charCodeAt(l))<=247?W.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?P.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L");for(var s=0,a=r;s<i;++s){var u=o[s];"m"==u?o[s]=a:a=u}for(var c=0,h=r;c<i;++c){var d=o[c];"1"==d&&"r"==h?o[c]="n":R.test(d)&&"r"==(h=d)&&(o[c]="R")}for(var f=1,p=o[0];f<i-1;++f){var g=o[f];"+"==g&&"1"==p&&"1"==o[f+1]?o[f]="1":","!=g||p!=o[f+1]||"1"!=p&&"n"!=p||(o[f]=p),p=g}for(var m=0;m<i;++m){var v=o[m];if(","==v)o[m]="N";else if("%"==v){var y=void 0;for(y=m+1;y<i&&"%"==o[y];++y);for(var b=m&&"!"==o[m-1]||y<i&&"1"==o[y]?"1":"N",k=m;k<y;++k)o[k]=b;m=y-1}}for(var x=0,w=r;x<i;++x){var _=o[x];"L"==w&&"1"==_?o[x]="L":R.test(_)&&(w=_)}for(var C=0;C<i;++C)if(I.test(o[C])){var S=void 0;for(S=C+1;S<i&&I.test(o[S]);++S);for(var L="L"==(C?o[C-1]:r),M=L==("L"==(S<i?o[S]:r))?L?"L":"R":r,T=C;T<S;++T)o[T]=M;C=S-1}for(var A,D=[],F=0;F<i;)if(B.test(o[F])){var O=F;for(++F;F<i&&B.test(o[F]);++F);D.push(new j(0,O,F))}else{var N=F,E=D.length;for(++F;F<i&&"L"!=o[F];++F);for(var q=N;q<F;)if($.test(o[q])){N<q&&D.splice(E,0,new j(1,N,q));var z=q;for(++q;q<F&&$.test(o[q]);++q);D.splice(E,0,new j(2,z,q)),N=q}else++q;N<F&&D.splice(E,0,new j(1,N,F))}return"ltr"==t&&(1==D[0].level&&(A=e.match(/^\s+/))&&(D[0].from=A[0].length,D.unshift(new j(0,0,A[0].length))),1==Z(D).level&&(A=e.match(/\s+$/))&&(Z(D).to-=A[0].length,D.push(new j(0,i-A[0].length,i)))),"rtl"==t?D.reverse():D}}();function Je(e,t){var r=e.order;return null==r&&(r=e.order=Qe(e.text,t)),r}var et=[],tt=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||et).concat(r)}};function rt(e,t){return e._handlers&&e._handlers[t]||et}function nt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=I(i,r);-1<o&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function it(e,t){var r=rt(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ot(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),it(e,r||t.type,e,t),ht(t)||t.codemirrorIgnore}function lt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==I(r,t[n])&&r.push(t[n])}function st(e,t){return 0<rt(e,t).length}function at(e){e.prototype.on=function(e,t){tt(this,e,t)},e.prototype.off=function(e,t){nt(this,e,t)}}function ut(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ct(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ht(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function dt(e){ut(e),ct(e)}function ft(e){return e.target||e.srcElement}function pt(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),k&&e.ctrlKey&&1==t&&(t=3),t}var gt,mt,vt=function(){if(x&&w<9)return!1;var e=D("div");return"draggable"in e||"dragDrop"in e}();function yt(e){if(null==gt){var t=D("span","");T(e,D("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(gt=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&w<8))}var r=gt?D("span",""):D("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function bt(e){if(null!=mt)return mt;var t=T(e,document.createTextNode("AخA")),r=S(t,0,1).getBoundingClientRect(),n=S(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(mt=n.right-r.right<3)}var kt,xt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},wt=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)},_t="oncopy"in(kt=D("div"))||(kt.setAttribute("oncopy","return;"),"function"==typeof kt.oncopy),Ct=null;var St={},Lt={};function Mt(e){if("string"==typeof e&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&"string"==typeof e.name&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Mt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Mt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Tt(e,t){t=Mt(t);var r=St[t.name];if(!r)return Tt(e,"text/plain");var n=r(e,t);if(At.hasOwnProperty(t.name)){var i=At[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var At={};function Dt(e,t){W(t,At.hasOwnProperty(e)?At[e]:At[e]={})}function Ft(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ot(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Nt(e,t,r){return!e.startState||e.startState(t,r)}var Et=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Et.prototype.eol=function(){return this.pos>=this.string.length},Et.prototype.sol=function(){return this.pos==this.lineStart},Et.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Et.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Et.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Et.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Et.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Et.prototype.skipToEnd=function(){this.pos=this.string.length},Et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Et.prototype.backUp=function(e){this.pos-=e},Et.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=P(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Et.prototype.indentation=function(){return P(this.string,null,this.tabSize)-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Et.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&0<n.index?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Et.prototype.current=function(){return this.string.slice(this.start,this.pos)},Et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Et.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var qt=function(e,t){this.state=e,this.lookAhead=t},zt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function Wt(t,r,n,e){var a=[t.state.modeGen],i={};Vt(t,r.text,t.doc.mode,n,function(e,t){return a.push(e,t)},i,e);for(var u=n.state,o=function(e){n.baseTokens=a;var o=t.state.overlays[e],l=1,s=0;n.state=!0,Vt(t,r.text,o.mode,n,function(e,t){for(var r=l;s<e;){var n=a[l];e<n&&a.splice(l,1,e,a[l+1],n),l+=2,s=Math.min(e,n)}if(t)if(o.opaque)a.splice(r,l-r,e,"overlay "+t),l=r+2;else for(;r<l;r+=2){var i=a[r+1];a[r+1]=(i?i+" ":"")+"overlay "+t}},i),n.state=u,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)o(l);return{styles:a,classes:i.bgClass||i.textClass?i:null}}function Pt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Ht(e,de(t)),i=t.text.length>e.options.maxHighlightLength&&Ft(e.doc.mode,n.state),o=Wt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ht(r,n,e){var t=r.doc,i=r.display;if(!t.mode.startState)return new zt(t,!0,n);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;l<s;--s){if(s<=o.first)return o.first;var a=ae(o,s-1),u=a.stateAfter;if(u&&(!r||s+(u instanceof qt?u.lookAhead:0)<=o.modeFrontier))return s;var c=P(a.text,null,e.options.tabSize);(null==i||c<n)&&(i=s-1,n=c)}return i}(r,n,e),l=o>t.first&&ae(t,o-1).stateAfter,s=l?zt.fromSaved(t,l,o):new zt(t,Nt(t.mode),o);return t.iter(o,n,function(e){It(r,e.text,s);var t=s.line;e.stateAfter=t==n-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?s.save():null,s.nextLine()}),e&&(t.modeFrontier=s.line),s}function It(e,t,r,n){var i=e.doc.mode,o=new Et(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Rt(i,r.state);!o.eol();)Bt(i,o,r.state),o.start=o.pos}function Rt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ot(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Bt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ot(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}zt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},zt.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}},zt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},zt.fromSaved=function(e,t,r){return t instanceof qt?new zt(e,Ft(e.mode,t.state),r,t.lookAhead):new zt(e,Ft(e.mode,t),r)},zt.prototype.save=function(e){var t=!1!==e?Ft(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new qt(t,this.maxLookAhead):t};var $t=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function jt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=ae(l,(t=_e(l,t)).line),u=Ht(e,t.line,r),c=new Et(a.text,e.options.tabSize,u);for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=Bt(s,c,u.state),n&&o.push(new $t(c,i,Ft(l.mode,u.state)));return n?o:new $t(c,i,u.state)}function Ut(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Vt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,h=new Et(t,e.options.tabSize,n),d=e.options.addModeClass&&[null];for(""==t&&Ut(Rt(r,n.state),o);!h.eol();){if(a=h.pos>e.options.maxHighlightLength?(s=!1,l&&It(e,t,n,h.pos),h.pos=t.length,null):Ut(Bt(r,h,n.state,d),o),d){var f=d[0].name;f&&(a="m-"+(a?f+" "+a:f))}if(!s||c!=a){for(;u<h.start;)i(u=Math.min(h.start,u+5e3),c);c=a}h.start=h.pos}for(;u<h.pos;){var p=Math.min(h.pos,u+5e3);i(p,c),u=p}}var Gt=function(e,t,r){this.text=e,Ne(this,t),this.height=r?r(this):1};Gt.prototype.lineNo=function(){return de(this)},at(Gt);var Kt={},Zt={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Zt:Kt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Yt(e,t){var r=A("span",null,null,b?"padding-right: .1px":null),n={pre:A("pre",[r],"CodeMirror-line"),content:r,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,l=void 0;n.pos=0,n.addToken=Jt,bt(e.display.measure)&&(l=Je(o,e.doc.direction))&&(n.addToken=er(n.addToken,l)),n.map=[],rr(o,n,Pt(e,o,t!=e.display.externalMeasured&&de(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=E(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=E(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(yt(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(b){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return it(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=E(n.pre.className,n.textClass||"")),n}function Qt(e){var t=D("span","","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,o,l){if(t){var s,a=e.splitSpaces?function(e,t){if(1<e.length&&!/  /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,u=e.cm.state.specialChars,c=!1;if(u.test(t)){s=document.createDocumentFragment();for(var h=0;;){u.lastIndex=h;var d=u.exec(t),f=d?d.index-h:t.length-h;if(f){var p=document.createTextNode(a.slice(h,h+f));x&&w<9?s.appendChild(D("span",[p])):s.appendChild(p),e.map.push(e.pos,e.pos+f,p),e.col+=f,e.pos+=f}if(!d)break;h+=f+1;var g=void 0;if("\t"==d[0]){var m=e.cm.options.tabSize,v=m-e.col%m;(g=s.appendChild(D("span",K(v),"cm-tab"))).setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=v}else"\r"==d[0]||"\n"==d[0]?(g=s.appendChild(D("span","\r"==d[0]?"":"","cm-invalidchar"))).setAttribute("cm-text",d[0]):((g=e.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),x&&w<9?s.appendChild(D("span",[g])):s.appendChild(g)),e.col+=1;e.map.push(e.pos,e.pos+1,g),e.pos++}}else e.col+=t.length,s=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,s),x&&w<9&&(c=!0),e.pos+=t.length;if(e.trailingSpace=32==a.charCodeAt(t.length-1),r||n||i||c||o){var y=r||"";n&&(y+=n),i&&(y+=i);var b=D("span",[s],y,o);if(l)for(var k in l)l.hasOwnProperty(k)&&"style"!=k&&"class"!=k&&b.setAttribute(k,l[k]);return e.content.appendChild(b)}e.content.appendChild(s)}}function er(h,d){return function(e,t,r,n,i,o,l){r=r?r+" cm-force-border":"cm-force-border";for(var s=e.pos,a=s+t.length;;){for(var u=void 0,c=0;c<d.length&&!((u=d[c]).to>s&&u.from<=s);c++);if(u.to>=a)return h(e,t,r,n,i,o,l);h(e,t.slice(0,u.to-s),r,n,null,o,l),n=null,t=t.slice(u.to-s),s=u.to}}}function tr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,h,d,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=u=c=s="",h=d=null,v=1/0;for(var y=[],b=void 0,k=0;k<n.length;++k){var x=n[k],w=x.marker;if("bookmark"==w.type&&x.from==p&&w.widgetNode)y.push(w);else if(x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,u=""),w.className&&(a+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(c+=" "+w.startStyle),w.endStyle&&x.to==v&&(b||(b=[])).push(w.endStyle,x.to),w.title&&((d||(d={})).title=w.title),w.attributes)for(var _ in w.attributes)(d||(d={}))[_]=w.attributes[_];w.collapsed&&(!h||ze(h.marker,w)<0)&&(h=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var C=0;C<b.length;C+=2)b[C+1]==v&&(u+=" "+b[C]);if(!h||h.from==p)for(var S=0;S<y.length;++S)tr(t,0,y[S]);if(h&&(h.from||0)==p){if(tr(t,(null==h.to?f+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(f<=p)break;for(var L=Math.min(f,v);;){if(m){var M=p+m.length;if(!h){var T=L<M?m.slice(0,L-p):m;t.addToken(t,T,l?l+a:a,c,p+T.length==v?u:"",s,d)}if(L<=M){m=m.slice(L-p),p=L;break}p=M,c=""}m=i.slice(o,o=r[g++]),l=Xt(r[g++],t.cm.options)}}else for(var A=1;A<r.length;A+=2)t.addToken(t,i.slice(o,o=r[A]),Xt(r[A+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=He(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?de(Z(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ue(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new nr(e.doc,ae(e.doc,o),o);n=o+l.size,i.push(l)}return i}var or=null;var lr=null;function sr(e,t){var r=rt(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);or?n=or.delayedCallbacks:lr?n=lr:(n=lr=[],setTimeout(ar,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function ar(){var e=lr;lr=null;for(var t=0;t<e.length;++t)e[t]()}function ur(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?dr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?fr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function cr(e){return e.node==e.text&&(e.node=D("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&w<8&&(e.node.style.zIndex=2)),e.node}function hr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Yt(e,t)}function dr(e,t){var r=t.text.className,n=hr(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,fr(e,t)):r&&(t.text.className=r)}function fr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=cr(t);t.background=n.insertBefore(D("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?cr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function pr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=cr(t);t.gutterBackground=D("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=cr(t),s=t.gutter=D("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(D("div",ge(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.options.gutters.length;++a){var u=e.options.gutters[a],c=o.hasOwnProperty(u)&&o[u];c&&s.appendChild(D("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function gr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);mr(e,t,r)}function mr(e,t,r){if(vr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)vr(e,t.rest[n],t,r,!1)}function vr(e,t,r,n,i){if(t.widgets)for(var o=cr(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=D("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),yr(a,u,r,n),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),sr(a,"redraw")}}function yr(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function br(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!F(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),T(t.display.measure,D("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function kr(e,t){for(var r=ft(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function xr(e){return e.lineSpace.offsetTop}function wr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function _r(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=T(e.measure,D("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Cr(e){return R-e.display.nativeBarWidth}function Sr(e){return e.display.scroller.clientWidth-Cr(e)-e.display.barWidth}function Lr(e){return e.display.scroller.clientHeight-Cr(e)-e.display.barHeight}function Mr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(de(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Tr(e,t,r,n){return Fr(e,Dr(e,t),r,n)}function Ar(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Dr(e,t){var r=de(t),n=Ar(e,r);n&&!n.text?n=null:n&&n.changes&&(ur(e,n,r,tn(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=de(t=Be(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Yt(e,n);return n.text=i.pre,T(e.display.lineMeasure,i.pre),n}(e,t));var i=Mr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Fr(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,r){var n=e.options.lineWrapping,i=n&&Sr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];2<Math.abs(a.bottom-u.bottom)&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Er(t.map,r,n),l=o.node,s=o.start,a=o.end,u=o.collapse;if(3==l.nodeType){for(var c=0;c<4;c++){for(;s&&ie(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+a));)++a;if((i=x&&w<9&&0==s&&a==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():qr(S(l,s,a).getClientRects(),n)).left||i.right||0==s)break;a=s,s-=1,u="right"}x&&w<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ct)return Ct;var t=T(e,D("span","x")),r=t.getBoundingClientRect(),n=S(t,0,1).getBoundingClientRect();return Ct=1<Math.abs(r.left-n.left)}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var h;0<s&&(u=n="right"),i=e.options.lineWrapping&&1<(h=l.getClientRects()).length?h["right"==n?h.length-1:0]:l.getBoundingClientRect()}if(x&&w<9&&!s&&(!i||!i.left&&!i.right)){var d=l.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+en(e.display),top:d.top,bottom:d.bottom}:Nr}for(var f=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(f+p)/2,m=t.view.measure.heights,v=0;v<m.length-1&&!(g<m[v]);v++);var y=v?m[v-1]:0,b=m[v],k={left:("right"==u?i.right:i.left)-t.rect.left,right:("left"==u?i.left:i.right)-t.rect.left,top:y,bottom:b};i.left||i.right||(k.bogus=!0);e.options.singleCursorHeightPerLine||(k.rtop=f,k.rbottom=p);return k}(e,t,r,n)).bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Or,Nr={left:0,right:0,top:0,bottom:0};function Er(e,t,r){for(var n,i,o,l,s,a,u=0;u<e.length;u+=3)if(s=e[u],a=e[u+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(u==e.length-3||t==a&&e[u+3]>t)&&(i=(o=a-s)-1,a<=t&&(l="right")),null!=i){if(n=e[u+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],l="left";if("right"==r&&i==a-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function qr(e,t){var r=Nr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;0<=i&&(r=e[i]).left==r.right;i--);return r}function zr(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 Wr(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)zr(e.display.view[t])}function Pr(e){Wr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Hr(){return l&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ir(){return l&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Rr(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=br(e.widgets[r]));return t}function Br(e,t,r,n,i){if(!i){var o=Rr(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=Ge(t);if("local"==n?l+=xr(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Ir());var a=s.left+("window"==n?0:Hr());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function $r(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Hr(),i-=Ir();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function jr(e,t,r,n,i){return n||(n=ae(e.doc,t.line)),Br(e,n,Tr(e,n,t.ch,i),r)}function Ur(n,e,i,o,l,s){function a(e,t){var r=Fr(n,l,e,t?"right":"left",s);return t?r.left=r.right:r.right=r.left,Br(n,o,r,i)}o=o||ae(n.doc,e.line),l||(l=Dr(n,o));var u=Je(o,n.doc.direction),t=e.ch,r=e.sticky;if(t>=o.text.length?(t=o.text.length,r="before"):t<=0&&(t=0,r="after"),!u)return a("before"==r?t-1:t,"before"==r);function c(e,t,r){return a(r?e-1:e,1==u[t].level!=r)}var h=Ye(u,t,r),d=Xe,f=c(t,h,"before"==r);return null!=d&&(f.other=c(t,d,"before"!=r)),f}function Vr(e,t){var r=0;t=_e(e.doc,t),e.options.lineWrapping||(r=en(e.display)*t.ch);var n=ae(e.doc,t.line),i=Ge(n)+xr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Gr(e,t,r,n,i){var o=me(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function Kr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Gr(n.first,0,null,!0,-1);var i=fe(n,r),o=n.first+n.size-1;if(o<i)return Gr(n.first+n.size-1,ae(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=ae(n,i);;){var s=Qr(e,l,i,t,r),a=Ie(l,s.ch+(0<s.xRel?1:0));if(!a)return s;var u=a.find(1);if(u.line==i)return u;l=ae(n,i=u.line)}}function Zr(t,e,r,n){n-=Rr(e);var i=e.text.length,o=le(function(e){return Fr(t,r,e-1).bottom<=n},i,0);return{begin:o,end:i=le(function(e){return Fr(t,r,e).top>n},o,i)}}function Xr(e,t,r,n){return r||(r=Dr(e,t)),Zr(e,t,r,Br(e,t,Fr(e,r,n),"line").top)}function Yr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Qr(r,e,t,n,i){i-=Ge(e);var o=Dr(r,e),l=Rr(e),s=0,a=e.text.length,u=!0,c=Je(e,r.doc.direction);if(c){var h=(r.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Zr(e,t,n,l),a=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,d=0;d<i.length;d++){var f=i[d];if(!(f.from>=u||f.to<=a)){var p=1!=f.level,g=Fr(e,n,p?Math.min(u,f.to)-1:Math.max(a,f.from)).right,m=g<o?o-g+1e9:g-o;(!c||m<h)&&(c=f,h=m)}}c||(c=i[i.length-1]);c.from<a&&(c={from:a,to:c.to,level:c.level});c.to>u&&(c={from:c.from,to:u,level:c.level});return c}:function(n,i,o,l,s,a,u){var e=le(function(e){var t=s[e],r=1!=t.level;return Yr(Ur(n,me(o,r?t.to:t.from,r?"before":"after"),"line",i,l),a,u,!0)},0,s.length-1),t=s[e];if(0<e){var r=1!=t.level,c=Ur(n,me(o,r?t.from:t.to,r?"after":"before"),"line",i,l);Yr(c,a,u,!0)&&c.top>u&&(t=s[e-1])}return t})(r,e,t,o,c,n,i);s=(u=1!=h.level)?h.from:h.to-1,a=u?h.to:h.from-1}var d,f,p=null,g=null,m=le(function(e){var t=Fr(r,o,e);return t.top+=l,t.bottom+=l,!!Yr(t,n,i,!1)&&(t.top<=i&&t.left<=n&&(p=e,g=t),!0)},s,a),v=!1;if(g){var y=n-g.left<g.right-n,b=y==u;m=p+(b?0:1),f=b?"after":"before",d=y?g.left:g.right}else{u||m!=a&&m!=s||m++,f=0==m?"after":m==e.text.length?"before":Fr(r,o,m-(u?1:0)).bottom+l<=i==u?"after":"before";var k=Ur(r,me(t,m,f),"line",e,o);d=k.left,v=i<k.top||i>=k.bottom}return Gr(t,m=oe(e.text,m,1),f,v,n-d)}function Jr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Or){Or=D("pre");for(var t=0;t<49;++t)Or.appendChild(document.createTextNode("x")),Or.appendChild(D("br"));Or.appendChild(document.createTextNode("x"))}T(e.measure,Or);var r=Or.offsetHeight/50;return 3<r&&(e.cachedTextHeight=r),M(e.measure),r||1}function en(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=D("span","xxxxxxxxxx"),r=D("pre",[t]);T(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return 2<i&&(e.cachedCharWidth=i),i||10}function tn(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:rn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function rn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function nn(n){var i=Jr(n.display),o=n.options.lineWrapping,l=o&&Math.max(5,n.display.scroller.clientWidth/en(n.display)-3);return function(e){if(Ue(n.doc,e))return 0;var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;r++)e.widgets[r].height&&(t+=e.widgets[r].height);return o?t+(Math.ceil(e.text.length/l)||1)*i:t+i}}function on(e){var t=e.doc,r=nn(e);t.iter(function(e){var t=r(e);t!=e.height&&he(e,t)})}function ln(e,t,r,n){var i=e.display;if(!r&&"true"==ft(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,u=Kr(e,o,l);if(n&&1==u.xRel&&(a=ae(e.doc,u.line).text).length==u.ch){var c=P(a,a.length,e.options.tabSize)-a.length;u=me(u.line,Math.max(0,Math.round((o-_r(e.display).left)/en(e.display))-c))}return u}function sn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function an(e){e.display.input.showSelection(e.display.input.prepareSelection())}function un(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&cn(e,s.head,i),a||dn(e,s,o)}}return n}function cn(e,t,r){var n=Ur(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(D("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(D("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function hn(e,t){return e.top-t.top||e.left-t.left}function dn(l,e,t){var r=l.display,n=l.doc,i=document.createDocumentFragment(),o=_r(l.display),L=o.left,M=Math.max(r.sizerWidth,Sr(l)-r.sizer.offsetLeft)-o.right,T="ltr"==n.direction;function A(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),i.appendChild(D("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n                             top: "+t+"px; width: "+(null==r?M-e:r)+"px;\n                             height: "+(n-t)+"px"))}function s(r,y,b){var k,x,o=ae(n,r),w=o.text.length;function _(e,t){return jr(l,me(r,e),"div",o,t)}function C(e,t,r){var n=Xr(l,o,null,e),i="ltr"==t==("after"==r)?"left":"right";return _("after"==r?n.begin:n.end-(/\s/.test(o.text.charAt(n.end-1))?2:1),i)[i]}var S=Je(o,n.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(S,y||0,null==b?w:b,function(e,t,r,n){var i="ltr"==r,o=_(e,i?"left":"right"),l=_(t-1,i?"right":"left"),s=null==y&&0==e,a=null==b&&t==w,u=0==n,c=!S||n==S.length-1;if(l.top-o.top<=3){var h=(T?a:s)&&c,d=(T?s:a)&&u?L:(i?o:l).left,f=h?M:(i?l:o).right;A(d,o.top,f-d,o.bottom)}else{var p,g,m,v;v=i?(p=T&&s&&u?L:o.left,g=T?M:C(e,r,"before"),m=T?L:C(t,r,"after"),T&&a&&c?M:l.right):(p=T?C(e,r,"before"):L,g=!T&&s&&u?M:o.right,m=!T&&a&&c?L:l.left,T?C(t,r,"after"):M),A(p,o.top,g-p,o.bottom),o.bottom<l.top&&A(L,o.bottom,null,l.top),A(m,l.top,v-m,l.bottom)}(!k||hn(o,k)<0)&&(k=o),hn(l,k)<0&&(k=l),(!x||hn(o,x)<0)&&(x=o),hn(l,x)<0&&(x=l)}),{start:k,end:x}}var a=e.from(),u=e.to();if(a.line==u.line)s(a.line,a.ch,u.ch);else{var c=ae(n,a.line),h=ae(n,u.line),d=Be(c)==Be(h),f=s(a.line,a.ch,d?c.text.length+1:null).end,p=s(u.line,d?0:null,u.ch).start;d&&(f.top<p.top-2?(A(f.right,f.top,null,f.bottom),A(L,p.top,p.left,p.bottom)):A(f.right,f.top,p.left-f.right,f.bottom)),f.bottom<p.top&&A(L,f.bottom,null,p.top)}t.appendChild(i)}function fn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function pn(e){e.state.focused||(e.display.input.focus(),mn(e))}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vn(e))},100)}function mn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(it(e,"focus",e,t),e.state.focused=!0,N(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),fn(e))}function vn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(it(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,l=void 0,s=0;if(!i.hidden){if(x&&w<8){var a=i.node.offsetTop+i.node.offsetHeight;l=a-r,r=a}else{var u=i.node.getBoundingClientRect();l=u.bottom-u.top,!o&&i.text.firstChild&&(s=i.text.firstChild.getBoundingClientRect().right-u.left-1)}var c=i.line.height-l;if((.005<c||c<-.005)&&(he(i.line,l),bn(i.line),i.rest))for(var h=0;h<i.rest.length;h++)bn(i.rest[h]);if(s>e.display.sizerWidth){var d=Math.ceil(s/en(e.display));d>e.display.maxLineLength&&(e.display.maxLineLength=d,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function bn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function kn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-xr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=fe(t,n),l=fe(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?l=fe(t,Ge(ae(t,o=s))+e.wrapper.clientHeight):Math.min(a,t.lastLine())>=l&&(o=fe(t,Ge(ae(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function xn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=rn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function wn(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=ge(e.options,t.first+t.size-1),n=e.display;if(r.length==n.lineNumChars)return!1;var i=n.measure.appendChild(D("div",[D("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",si(e),!0}function _n(e,t){var r=e.display,n=Jr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Lr(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+wr(r),a=t.top<n,u=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(l.scrollTop=c)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Sr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),f=t.right-t.left>d;return f&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<h?l.scrollLeft=Math.max(0,t.left-(f?0:10)):t.right>d+h-3&&(l.scrollLeft=t.right+(f?0:10)-d),l}function Cn(e,t){null!=t&&(Mn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sn(e){Mn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ln(e,t,r){null==t&&null==r||Mn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Mn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Tn(e,Vr(e,t.from),Vr(e,t.to),t.margin))}function Tn(e,t,r,n){var i=_n(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Ln(e,i.scrollLeft,i.scrollTop)}function An(e,t){Math.abs(e.doc.scrollTop-t)<2||(g||li(e,{top:t}),Dn(e,t,!0),g&&li(e),ti(e,100))}function Dn(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Fn(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,xn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function On(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+wr(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?r:0,docHeight:n,scrollHeight:n+Cr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Nn=function(e,t,r){this.cm=r;var n=this.vert=D("div",[D("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=D("div",[D("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),tt(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),tt(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&w<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Nn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Nn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Nn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Nn.prototype.zeroWidthHack=function(){var e=k&&!s?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new H,this.disableVert=new H},Nn.prototype.enableZeroWidthBar=function(r,n,i){r.style.pointerEvents="auto",n.set(1e3,function e(){var t=r.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=r?r.style.pointerEvents="none":n.set(1e3,e)})},Nn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var En=function(){};function qn(e,t){t||(t=On(e));var r=e.display.barWidth,n=e.display.barHeight;zn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&yn(e),zn(e,On(e)),r=e.display.barWidth,n=e.display.barHeight}function zn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}En.prototype.update=function(){return{bottom:0,right:0}},En.prototype.setScrollLeft=function(){},En.prototype.setScrollTop=function(){},En.prototype.clear=function(){};var Wn={native:Nn,null:En};function Pn(r){r.display.scrollbars&&(r.display.scrollbars.clear(),r.display.scrollbars.addClass&&L(r.display.wrapper,r.display.scrollbars.addClass)),r.display.scrollbars=new Wn[r.options.scrollbarStyle](function(e){r.display.wrapper.insertBefore(e,r.display.scrollbarFiller),tt(e,"mousedown",function(){r.state.focused&&setTimeout(function(){return r.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?Fn(r,e):An(r,e)},r),r.display.scrollbars.addClass&&N(r.display.wrapper,r.display.scrollbars.addClass)}var Hn=0;function In(e){var t;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:++Hn},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function Rn(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{or=null,t(r)}}(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)Bn(t[r]);for(var n=0;n<t.length;n++)(i=t[n]).updatedDisplay=i.mustUpdate&&ii(i.cm,i.update);var i;for(var o=0;o<t.length;o++)$n(t[o]);for(var l=0;l<t.length;l++)jn(t[l]);for(var s=0;s<t.length;s++)Un(t[s])}(e)})}function Bn(e){var t,r,n=e.cm,i=n.display;!(r=(t=n).display).scrollbarsClipped&&r.scroller.offsetWidth&&(r.nativeBarWidth=r.scroller.offsetWidth-r.scroller.clientWidth,r.heightForcer.style.height=Cr(t)+"px",r.sizer.style.marginBottom=-r.nativeBarWidth+"px",r.sizer.style.borderRightWidth=Cr(t)+"px",r.scrollbarsClipped=!0),e.updateMaxLine&&Ze(n),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new ni(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function $n(e){var t=e.cm,r=t.display;e.updatedDisplay&&yn(t),e.barMeasure=On(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Tr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Cr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Sr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function jn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==O();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&qn(t,e.barMeasure),e.updatedDisplay&&ai(t,e.barMeasure),e.selectionChanged&&fn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&pn(e.cm)}function Un(e){var t=e.cm,r=t.display,n=t.doc;(e.updatedDisplay&&oi(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&Dn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Fn(t,e.scrollLeft,!0,!0),e.scrollToPos)&&function(e,t){if(!ot(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!u){var o=D("div","",null,"position: absolute;\n                         top: "+(t.top-r.viewOffset-xr(e.display))+"px;\n                         height: "+(t.bottom-t.top+Cr(e)+r.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?me(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?me(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Ur(e,t),a=r&&r!=t?Ur(e,r):s,u=_n(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(An(e,u.scrollTop),1<Math.abs(e.doc.scrollTop-c)&&(l=!0)),null!=u.scrollLeft&&(Fn(e,u.scrollLeft),1<Math.abs(e.doc.scrollLeft-h)&&(l=!0)),!l)break}return i}(t,_e(n,e.scrollToPos.from),_e(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||it(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&it(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&it(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Vn(e,t){if(e.curOp)return t();In(e);try{return t()}finally{Rn(e)}}function Gn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);In(e);try{return t.apply(e,arguments)}finally{Rn(e)}}}function Kn(e){return function(){if(this.curOp)return e.apply(this,arguments);In(this);try{return e.apply(this,arguments)}finally{Rn(this)}}}function Zn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);In(e);try{return t.apply(this,arguments)}finally{Rn(e)}}}function Xn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Le&&$e(e.doc,t)<i.viewTo&&Qn(e);else if(r<=i.viewFrom)Le&&je(e.doc,r+n)>i.viewFrom?Qn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Qn(e);else if(t<=i.viewFrom){var o=Jn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Qn(e)}else if(r>=i.viewTo){var l=Jn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Qn(e)}else{var s=Jn(e,t,t,-1),a=Jn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(ir(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):Qn(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function Yn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[sn(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==I(l,r)&&l.push(r)}}}function Qn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Jn(e,t,r,n){var i,o=sn(e,t),l=e.display.view;if(!Le||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(0<n){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;$e(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function ei(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,z(ri,e))}function ri(a){var u=a.doc;if(!(u.highlightFrontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,h=Ht(a,u.highlightFrontier),d=[];u.iter(h.line,Math.min(u.first+u.size,a.display.viewTo+500),function(e){if(h.line>=a.display.viewFrom){var t=e.styles,r=e.text.length>a.options.maxHighlightLength?Ft(u.mode,h.state):null,n=Wt(a,e,h,!0);r&&(h.state=r),e.styles=n.styles;var i=e.styleClasses,o=n.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var l=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),s=0;!l&&s<t.length;++s)l=t[s]!=e.styles[s];l&&d.push(h.line),e.stateAfter=h.save(),h.nextLine()}else e.text.length<=a.options.maxHighlightLength&&It(a,e.text,h),e.stateAfter=h.line%5==0?h.save():null,h.nextLine();if(+new Date>c)return ti(a,a.options.workDelay),!0}),u.highlightFrontier=h.line,u.modeFrontier=Math.max(u.modeFrontier,h.line),d.length&&Vn(a,function(){for(var e=0;e<d.length;e++)Yn(a,d[e],"text")})}}var ni=function(e,t,r){var n=e.display;this.viewport=t,this.visible=kn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Sr(e),this.force=r,this.dims=tn(e),this.events=[]};function ii(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Qn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==ei(e))return!1;wn(e)&&(Qn(e),t.dims=tn(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Le&&(o=$e(e.doc,o),l=je(e.doc,l));var s,a,u,c,h=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;a=o,u=l,0==(c=(s=e).display).view.length||a>=c.viewTo||u<=c.viewFrom?(c.view=ir(s,a,u),c.viewFrom=a):(c.viewFrom>a?c.view=ir(s,a,c.viewFrom).concat(c.view):c.viewFrom<a&&(c.view=c.view.slice(sn(s,a))),c.viewFrom=a,c.viewTo<u?c.view=c.view.concat(ir(s,c.viewTo,u)):c.viewTo>u&&(c.view=c.view.slice(0,sn(s,u)))),c.viewTo=u,r.viewOffset=Ge(ae(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var d=ei(e);if(!h&&0==d&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var f=function(e){if(e.hasFocus())return null;var t=O();if(!t||!F(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&F(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return 4<d&&(r.lineDiv.style.display="none"),function(r,e,t){var n=r.display,i=r.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(e){var t=e.nextSibling;return b&&k&&r.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var a=n.view,u=n.viewFrom,c=0;c<a.length;c++){var h=a[c];if(h.hidden);else if(h.node&&h.node.parentNode==o){for(;l!=h.node;)l=s(l);var d=i&&null!=e&&e<=u&&h.lineNumber;h.changes&&(-1<I(h.changes,"gutter")&&(d=!1),ur(r,h,u,t)),d&&(M(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(ge(r.options,u)))),l=h.node.nextSibling}else{var f=(m=u,v=t,void 0,y=hr(p=r,g=h),g.text=g.node=y.pre,y.bgClass&&(g.bgClass=y.bgClass),y.textClass&&(g.textClass=y.textClass),fr(p,g),pr(p,g,m,v),mr(p,g,v),g.node);o.insertBefore(f,l)}u+=h.size}var p,g,m,v,y;for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),4<d&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=O()&&(e.activeElt.focus(),e.anchorNode&&F(document.body,e.anchorNode)&&F(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(f),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,h&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ti(e,400)),!(r.updateLineNumbers=null)}function oi(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Sr(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+wr(e.display)-Lr(e),r.top)}),t.visible=kn(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ii(e,t);n=!1){yn(e);var i=On(e);an(e),qn(e,i),ai(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function li(e,t){var r=new ni(e,t);if(ii(e,r)){yn(e),oi(e,r);var n=On(e);an(e),qn(e,n),ai(e,n),r.finish()}}function si(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function ai(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+Cr(e)+"px"}function ui(e){var t=e.display.gutters,r=e.options.gutters;M(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(D("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&((e.display.lineGutter=o).style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",si(e)}function ci(e){var t=I(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):-1<t&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}ni.prototype.signal=function(e,t){st(e,t)&&this.events.push(arguments)},ni.prototype.finish=function(){for(var e=0;e<this.events.length;e++)it.apply(null,this.events[e])};var hi=0,di=null;function fi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function pi(e){var t=fi(e);return t.x*=di,t.y*=di,t}function gi(e,t){var r=fi(t),n=r.x,i=r.y,o=e.display,l=o.scroller,s=l.scrollWidth>l.clientWidth,a=l.scrollHeight>l.clientHeight;if(n&&s||i&&a){if(i&&k&&b)e:for(var u=t.target,c=o.view;u!=l;u=u.parentNode)for(var h=0;h<c.length;h++)if(c[h].node==u){e.display.currentWheelTarget=u;break e}if(n&&!g&&!m&&null!=di)return i&&a&&An(e,Math.max(0,l.scrollTop+i*di)),Fn(e,Math.max(0,l.scrollLeft+n*di)),(!i||i&&a)&&ut(t),void(o.wheelStartX=null);if(i&&null!=di){var d=i*di,f=e.doc.scrollTop,p=f+o.wrapper.clientHeight;d<0?f=Math.max(0,f+d-50):p=Math.min(e.doc.height,p+d+50),li(e,{top:f,bottom:p})}hi<20&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(di=(di*hi+r)/(hi+1),++hi)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}x?di=-.53:g?di=15:l?di=-.7:a&&(di=-1/3);var mi=function(e,t){this.ranges=e,this.primIndex=t};mi.prototype.primary=function(){return this.ranges[this.primIndex]},mi.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 r=this.ranges[t],n=e.ranges[t];if(!ye(r.anchor,n.anchor)||!ye(r.head,n.head))return!1}return!0},mi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vi(be(this.ranges[t].anchor),be(this.ranges[t].head));return new mi(e,this.primIndex)},mi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(0<=ve(t,n.from())&&ve(e,n.to())<=0)return r}return-1};var vi=function(e,t){this.anchor=e,this.head=t};function yi(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(e,t){return ve(e.from(),t.from())}),r=I(t,i);for(var o=1;o<t.length;o++){var l=t[o],s=t[o-1],a=ve(s.to(),l.from());if(n&&!l.empty()?0<a:0<=a){var u=xe(s.from(),l.from()),c=ke(s.to(),l.to()),h=s.empty()?l.from()==l.head:s.from()==s.head;o<=r&&--r,t.splice(--o,2,new vi(h?c:u,h?u:c))}}return new mi(t,r)}function bi(e,t){return new mi([new vi(e,t||e)],0)}function ki(e){return e.text?me(e.from.line+e.text.length-1,Z(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function xi(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return ki(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ki(t).ch-t.to.ch),me(r,n)}function wi(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new vi(xi(i.anchor,t),xi(i.head,t)))}return yi(e.cm,r,e.sel.primIndex)}function _i(e,t,r){return e.line==t.line?me(r.line,e.ch-t.ch+r.ch):me(r.line+(e.line-t.line),e.ch)}function Ci(e){e.doc.mode=Tt(e.options,e.doc.modeOption),Si(e)}function Si(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,ti(e,100),e.state.modeGen++,e.curOp&&Xn(e)}function Li(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Z(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Mi(e,n,t,i){function o(e){return t?t[e]:null}function r(e,t,r){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Oe(e),Ne(e,r);var i=n?n(e):1;i!=e.height&&he(e,i)}(e,t,r,i),sr(e,"change",e,n)}function l(e,t){for(var r=[],n=e;n<t;++n)r.push(new Gt(u[n],o(n),i));return r}var s=n.from,a=n.to,u=n.text,c=ae(e,s.line),h=ae(e,a.line),d=Z(u),f=o(u.length-1),p=a.line-s.line;if(n.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(Li(e,n)){var g=l(0,u.length-1);r(h,h.text,f),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(c==h)if(1==u.length)r(c,c.text.slice(0,s.ch)+d+c.text.slice(a.ch),f);else{var m=l(1,u.length-1);m.push(new Gt(d+c.text.slice(a.ch),f,i)),r(c,c.text.slice(0,s.ch)+u[0],o(0)),e.insert(s.line+1,m)}else if(1==u.length)r(c,c.text.slice(0,s.ch)+u[0]+h.text.slice(a.ch),o(0)),e.remove(s.line+1,p);else{r(c,c.text.slice(0,s.ch)+u[0],o(0)),r(h,d+h.text.slice(a.ch),f);var v=l(1,u.length-1);1<p&&e.remove(s.line+1,p-1),e.insert(s.line+1,v)}sr(e,"change",e,n)}function Ti(e,s,a){!function e(t,r,n){if(t.linked)for(var i=0;i<t.linked.length;++i){var o=t.linked[i];if(o.doc!=r){var l=n&&o.sharedHist;a&&!l||(s(o.doc,l),e(o.doc,t,l))}}}(e,null,!0)}function Ai(e,t){if(t.cm)throw new Error("This document is already in use.");on((e.doc=t).cm=e),Ci(e),Di(e),e.options.lineWrapping||Ze(e),e.options.mode=t.modeOption,Xn(e)}function Di(e){("rtl"==e.doc.direction?N:L)(e.display.lineDiv,"CodeMirror-rtl")}function Fi(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Oi(e,t){var r={from:be(t.from),to:ki(t),text:ue(e,t.from,t.to)};return Wi(e,r,t.from.line,t.to.line+1),Ti(e,function(e){return Wi(e,r,t.from.line,t.to.line+1)},!0),r}function Ni(e){for(;e.length;){if(!Z(e).ranges)break;e.pop()}}function Ei(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,s,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(s=i).lastOp==n?(Ni(s.done),Z(s.done)):s.done.length&&!Z(s.done).ranges?Z(s.done):1<s.done.length&&!s.done[s.done.length-2].ranges?(s.done.pop(),Z(s.done)):void 0))l=Z(o.changes),0==ve(t.from,t.to)&&0==ve(t.from,l.to)?l.to=ki(t):o.changes.push(Oi(e,t));else{var u=Z(i.done);for(u&&u.ranges||zi(e.sel,i.done),o={changes:[Oi(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(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||it(e,"historyAdded")}function qi(e,t,r,n){var i,o,l,s,a,u=e.history,c=n&&n.origin;r==u.lastSelOp||c&&u.lastSelOrigin==c&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==c||(i=e,o=c,l=Z(u.done),s=t,"*"==(a=o.charAt(0))||"+"==a&&l.ranges.length==s.ranges.length&&l.somethingSelected()==s.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?u.done[u.done.length-1]=t:zi(t,u.done),u.lastSelTime=+new Date,u.lastSelOrigin=c,u.lastSelOp=r,n&&!1!==n.clearRedo&&Ni(u.undone)}function zi(e,t){var r=Z(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Wi(t,r,e,n){var i=r["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,n),function(e){e.markedSpans&&((i||(i=r["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Pi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Hi(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Pi(r[i]));return n}(e,t),n=De(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function Ii(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?mi.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var u=l[a],c=void 0;if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&-1<I(t,Number(c[1]))&&(Z(s)[h]=u[h],delete u[h])}}}return n}function Ri(e,t,r,n){if(n){var i=e.anchor;if(r){var o=ve(t,i)<0;o!=ve(r,i)<0?(i=t,t=r):o!=ve(t,r)<0&&(t=r)}return new vi(i,t)}return new vi(r||t,t)}function Bi(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Gi(e,new mi([Ri(e.sel.primary(),t,r,i)],0),n)}function $i(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Ri(e.sel.ranges[o],t[o],null,i);Gi(e,yi(e.cm,n,e.sel.primIndex),r)}function ji(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Gi(e,yi(e.cm,i,e.sel.primIndex),n)}function Ui(e,t,r,n){Gi(e,bi(t,r),n)}function Vi(e,t,r){var n=e.history.done,i=Z(n);i&&i.ranges?Ki(e,n[n.length-1]=t,r):Gi(e,t,r)}function Gi(e,t,r){Ki(e,t,r),qi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Ki(e,t,r){var n,i,o,l;(st(e,"beforeSelectionChange")||e.cm&&st(e.cm,"beforeSelectionChange"))&&(n=e,o=r,l={ranges:(i=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new vi(_e(n,e[t].anchor),_e(n,e[t].head))},origin:o&&o.origin},it(n,"beforeSelectionChange",n,l),n.cm&&it(n.cm,"beforeSelectionChange",n.cm,l),t=l.ranges!=i.ranges?yi(n.cm,l.ranges,l.ranges.length-1):i),Zi(e,Yi(e,t,r&&r.bias||(ve(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),r&&!1===r.scroll||!e.cm||Sn(e.cm)}function Zi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,lt(e.cm)),sr(e,"cursorActivity",e))}function Xi(e){Zi(e,Yi(e,e.sel,null,!1))}function Yi(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=Ji(e,l.anchor,s&&s.anchor,r,n),u=Ji(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new vi(a,u))}return i?yi(e.cm,i,t.primIndex):t}function Qi(e,t,r,n,i){var o=ae(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker;if((null==s.from||(a.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(a.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(it(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var u=a.find(n<0?1:-1),c=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(u=eo(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=ve(u,r))&&(n<0?c<0:0<c))return Qi(e,u,t,n,i)}var h=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(h=eo(e,h,n,h.line==t.line?o:null)),h?Qi(e,h,t,n,i):null}}return t}function Ji(e,t,r,n,i){var o=n||1,l=Qi(e,t,r,o,i)||!i&&Qi(e,t,r,o,!0)||Qi(e,t,r,-o,i)||!i&&Qi(e,t,r,-o,!0);return l||(e.cantEdit=!0,me(e.first,0))}function eo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?_e(e,me(t.line-1)):null:0<r&&t.ch==(n||ae(e,t.line)).text.length?t.line<e.first+e.size-1?me(t.line+1,0):null:new me(t.line,t.ch+r)}function to(e){e.setSelection(me(e.firstLine(),0),me(e.lastLine()),$)}function ro(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,r,n){e&&(o.from=_e(i,e)),t&&(o.to=_e(i,t)),r&&(o.text=r),void 0!==n&&(o.origin=n)}),it(i,"beforeChange",i,o),i.cm&&it(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 no(e,t,r){if(e.cm){if(!e.cm.curOp)return Gn(e.cm,no)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(st(e,"beforeChange")||e.cm&&st(e.cm,"beforeChange"))||(t=ro(e,t,!0))){var n=Se&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=I(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var u=i[a];if(!(ve(u.to,s.from)<0||0<ve(u.from,s.to))){var c=[a,1],h=ve(u.from,s.from),d=ve(u.to,s.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(0<d||!l.inclusiveRight&&!d)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;0<=i;--i)io(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else io(e,t)}}function io(e,r){if(1!=r.text.length||""!=r.text[0]||0!=ve(r.from,r.to)){var t=wi(e,r);Ei(e,r,t,e.cm?e.cm.curOp.id:NaN),so(e,r,t,De(e,r));var n=[];Ti(e,function(e,t){t||-1!=I(n,e.history)||(ho(e.history,r),n.push(e.history)),so(e,r,null,De(e,r))})}}function oo(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var l,r=i.history,n=i.sel,s="undo"==o?r.done:r.undone,a="undo"==o?r.undone:r.done,u=0;u<s.length&&(l=s[u],e?!l.ranges||l.equals(i.sel):l.ranges);u++);if(u!=s.length){for(r.lastOrigin=r.lastSelOrigin=null;;){if(!(l=s.pop()).ranges){if(t)return void s.push(l);break}if(zi(l,a),e&&!l.equals(i.sel))return void Gi(i,l,{clearRedo:!1});n=l}var c=[];zi(n,a),a.push({changes:c,generation:r.generation}),r.generation=l.generation||++r.maxGeneration;for(var h=st(i,"beforeChange")||i.cm&&st(i.cm,"beforeChange"),d=function(e){var r=l.changes[e];if(r.origin=o,h&&!ro(i,r,!1))return s.length=0,{};c.push(Oi(i,r));var t=e?wi(i,r):Z(s);so(i,r,t,Hi(i,r)),!e&&i.cm&&i.cm.scrollIntoView({from:r.from,to:ki(r)});var n=[];Ti(i,function(e,t){t||-1!=I(n,e.history)||(ho(e.history,r),n.push(e.history)),so(e,r,null,Hi(e,r))})},f=l.changes.length-1;0<=f;--f){var p=d(f);if(p)return p.v}}}}function lo(e,t){if(0!=t&&(e.first+=t,e.sel=new mi(X(e.sel.ranges,function(e){return new vi(me(e.anchor.line+t,e.anchor.ch),me(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Xn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Yn(e.cm,n,"gutter")}}function so(e,t,r,n){if(e.cm&&!e.cm.curOp)return Gn(e.cm,so)(e,t,r,n);if(t.to.line<e.first)lo(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);lo(e,i),t={from:me(e.first,0),to:me(t.to.line+i,t.to.ch),text:[Z(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:me(o,ae(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ue(e,t.from,t.to),r||(r=wi(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=de(Be(ae(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0}));-1<n.sel.contains(t.from,t.to)&&lt(e);Mi(n,t,r,nn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=Ke(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 r=e.first,n=t-1;r<n;n--){var i=ae(e,n).stateAfter;if(i&&(!(i instanceof qt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),ti(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?Xn(e):o.line!=l.line||1!=t.text.length||Li(e.doc,t)?Xn(e,o.line,l.line+1,u):Yn(e,o.line,"text");var c=st(e,"changes"),h=st(e,"change");if(h||c){var d={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&sr(e,"change",e,d),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}(e.cm,t,n):Mi(e,t,n),Ki(e,r,$)}}function ao(e,t,r,n,i){var o;n||(n=r),ve(n,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),no(e,{from:r,to:n,text:t,origin:i})}function uo(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function co(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)uo(o.ranges[s].anchor,t,r,n),uo(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var u=o.changes[a];if(r<u.from.line)u.from=me(u.from.line+n,u.from.ch),u.to=me(u.to.line+n,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function ho(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;co(e.done,r,n,i),co(e.undone,r,n,i)}function fo(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=ae(e,we(e,t)):i=de(t),null==i?null:(n(o,i)&&e.cm&&Yn(e.cm,i,r),o)}function po(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function go(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}vi.prototype.from=function(){return xe(this.anchor,this.head)},vi.prototype.to=function(){return ke(this.anchor,this.head)},vi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},po.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r,n=e,i=e+t;n<i;++n){var o=this.lines[n];this.height-=o.height,(r=o).parent=null,Oe(r),sr(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},go.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof po))){var s=[];this.collapse(s),this.children=[new po(s)],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,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&50<i.lines.length){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new po(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new go(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=I(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new go(e.children);(n.parent=e).children=[n,t],e=n}t.parent=e.parent}while(10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var mo=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function vo(e,t,r){Ge(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Cn(e,r)}mo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=de(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=br(this);he(r,Math.max(0,r.height-o)),e&&(Vn(e,function(){vo(e,r,-o),Yn(e,n,"widget")}),sr(e,"lineWidgetCleared",e,this,n))}},mo.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=br(this)-t;i&&(Ue(this.doc,n)||he(n,n.height+i),r&&Vn(r,function(){r.curOp.forceUpdate=!0,vo(r,n,i),sr(r,"lineWidgetChanged",r,e,de(n))}))},at(mo);var yo=0,bo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++yo};function ko(t,n,i,e,r){if(e&&e.shared)return function(e,r,n,i,o){(i=W(i)).shared=!1;var l=[ko(e,r,n,i,o)],s=l[0],a=i.widgetNode;return Ti(e,function(e){a&&(i.widgetNode=a.cloneNode(!0)),l.push(ko(e,_e(e,r),_e(e,n),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=Z(l)}),new xo(l,s)}(t,n,i,e,r);if(t.cm&&!t.cm.curOp)return Gn(t.cm,ko)(t,n,i,e,r);var o=new bo(t,r),l=ve(n,i);if(e&&W(e,o,!1),0<l||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=A("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Re(t,n.line,n,i,o)||n.line!=i.line&&Re(t,i.line,n,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Le=!0}o.addToHistory&&Ei(t,{from:n,to:i,origin:"markText"},t.sel,NaN);var s,a=n.line,u=t.cm;if(t.iter(a,i.line+1,function(e){var t,r;u&&o.collapsed&&!u.options.lineWrapping&&Be(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=n.line&&he(e,0),t=e,r=new Me(o,a==n.line?n.ch:null,a==i.line?i.ch:null),t.markedSpans=t.markedSpans?t.markedSpans.concat([r]):[r],r.marker.attachLine(t),++a}),o.collapsed&&t.iter(n.line,i.line+1,function(e){Ue(t,e)&&he(e,0)}),o.clearOnEnter&&tt(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Se=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++yo,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Xn(u,n.line,i.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=n.line;c<=i.line;c++)Yn(u,c,"text");o.atomic&&Xi(u.doc),sr(u,"markerAdded",u,o)}return o}bo.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&In(t),st(this,"clear")){var n=this.find();n&&sr(this,"clear",n.from,n.to)}for(var i=null,o=null,l=0;l<this.lines.length;++l){var s=e.lines[l],a=Te(s.markedSpans,e);t&&!e.collapsed?Yn(t,de(s),"text"):t&&(null!=a.to&&(o=de(s)),null!=a.from&&(i=de(s))),s.markedSpans=Ae(s.markedSpans,a),null==a.from&&e.collapsed&&!Ue(e.doc,s)&&t&&he(s,Jr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=Be(e.lines[u]),h=Ke(c);h>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=h,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&Xn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Xi(t.doc)),t&&sr(t,"markerCleared",t,this,i,o),r&&Rn(t),this.parent&&this.parent.clear()}},bo.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=Te(o.markedSpans,this);if(null!=l.from&&(r=me(t?o:de(o),l.from),-1==e))return r;if(null!=l.to&&(n=me(t?o:de(o),l.to),1==e))return n}return r&&{from:r,to:n}},bo.prototype.changed=function(){var o=this,l=this.find(-1,!0),s=this,a=this.doc.cm;l&&a&&Vn(a,function(){var e=l.line,t=de(l.line),r=Ar(a,t);if(r&&(zr(r),a.curOp.selectionChanged=a.curOp.forceUpdate=!0),a.curOp.updateMaxLine=!0,!Ue(s.doc,e)&&null!=s.height){var n=s.height;s.height=null;var i=br(s)-n;i&&he(e,e.height+i)}sr(a,"markerChanged",a,o)})},bo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=I(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},bo.prototype.detachLine=function(e){if(this.lines.splice(I(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},at(bo);var xo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function wo(e){return e.findMarks(me(e.first,0),e.clipPos(me(e.lastLine())),function(e){return e.parent})}function _o(o){for(var e=function(e){var t=o[e],r=[t.primary.doc];Ti(t.primary.doc,function(e){return r.push(e)});for(var n=0;n<t.markers.length;n++){var i=t.markers[n];-1==I(r,i.doc)&&(i.parent=null,t.markers.splice(n--,1))}},t=0;t<o.length;t++)e(t)}xo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();sr(this,"clear")}},xo.prototype.find=function(e,t){return this.primary.find(e,t)},at(xo);var Co=0,So=function(e,t,r,n,i){if(!(this instanceof So))return new So(e,t,r,n,i);null==r&&(r=0),go.call(this,[new po([new Gt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=me(r,0);this.sel=bi(o),this.history=new Fi(null),this.id=++Co,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Mi(this,{from:o,to:o,text:e}),Gi(this,bi(o),$)};So.prototype=Q(go.prototype,{constructor:So,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ce(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Zn(function(e){var t=me(this.first,0),r=this.first+this.size-1;no(this,{from:t,to:me(r,ae(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ln(this.cm,0,0),Gi(this,bi(t),$)}),replaceRange:function(e,t,r,n){ao(this,e,t=_e(this,t),r=r?_e(this,r):t,n)},getRange:function(e,t,r){var n=ue(this,_e(this,e),_e(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(pe(this,e))return ae(this,e)},getLineNumber:function(e){return de(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=ae(this,e)),Be(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return _e(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Zn(function(e,t,r){Ui(this,_e(this,"number"==typeof e?me(e,t||0):e),null,r)}),setSelection:Zn(function(e,t,r){Ui(this,_e(this,e),_e(this,t||e),r)}),extendSelection:Zn(function(e,t,r){Bi(this,_e(this,e),t&&_e(this,t),r)}),extendSelections:Zn(function(e,t){$i(this,Ce(this,e),t)}),extendSelectionsBy:Zn(function(e,t){$i(this,Ce(this,X(this.sel.ranges,e)),t)}),setSelections:Zn(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new vi(_e(this,e[i].anchor),_e(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Gi(this,yi(this.cm,n,t),r)}}),addSelection:Zn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new vi(_e(this,e),_e(this,t||e))),Gi(this,yi(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ue(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=ue(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Zn(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&function(e,t,r){for(var n=[],i=me(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=_i(s.from,i,o),u=_i(ki(s),i,o);if(i=s.to,o=u,"around"==r){var c=e.sel.ranges[l],h=ve(c.head,c.anchor)<0;n[l]=new vi(h?u:a,h?a:u)}else n[l]=new vi(a,a)}return new mi(n,e.sel.primIndex)}(this,n,t),a=n.length-1;0<=a;a--)no(this,n[a]);s?Vi(this,s):this.cm&&Sn(this.cm)}),undo:Zn(function(){oo(this,"undo")}),redo:Zn(function(){oo(this,"redo")}),undoSelection:Zn(function(){oo(this,"undo",!0)}),redoSelection:Zn(function(){oo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Fi(this.history.maxGeneration)},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:Ii(this.history.done),undone:Ii(this.history.undone)}},setHistory:function(e){var t=this.history=new Fi(this.history.maxGeneration);t.done=Ii(e.done.slice(0),null,!0),t.undone=Ii(e.undone.slice(0),null,!0)},setGutterMarker:Zn(function(e,r,n){return fo(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[r]=n)&&re(t)&&(e.gutterMarkers=null),!0})}),clearGutter:Zn(function(t){var r=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&fo(r,e,"gutter",function(){return e.gutterMarkers[t]=null,re(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!pe(this,e))return null;if(!(e=ae(this,t=e)))return null}else if(null==(t=de(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:Zn(function(e,r,n){return fo(this,e,"gutter"==r?"gutter":"class",function(e){var t="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(e[t]){if(C(n).test(e[t]))return!1;e[t]+=" "+n}else e[t]=n;return!0})}),removeLineClass:Zn(function(e,o,l){return fo(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",r=e[t];if(!r)return!1;if(null==l)e[t]=null;else{var n=r.match(C(l));if(!n)return!1;var i=n.index+n[0].length;e[t]=r.slice(0,n.index)+(n.index&&i!=r.length?" ":"")+r.slice(i)||null}return!0})}),addLineWidget:Zn(function(e,t,r){return i=e,o=new mo(n=this,t,r),(l=n.cm)&&o.noHScroll&&(l.display.alignWidgets=!0),fo(n,i,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(null==o.insertAt?t.push(o):t.splice(Math.min(t.length-1,Math.max(0,o.insertAt)),0,o),o.line=e,l&&!Ue(n,e)){var r=Ge(e)<n.scrollTop;he(e,e.height+br(o)),r&&Cn(l,o.height),l.curOp.forceUpdate=!0}return!0}),l&&sr(l,"lineWidgetAdded",l,o,"number"==typeof i?i:de(i)),o;var n,i,o,l}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return ko(this,_e(this,e),_e(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return ko(this,e=_e(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=ae(this,(e=_e(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(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,l){i=_e(this,i),o=_e(this,o);var s=[],a=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;r++){var n=t[r];null!=n.to&&a==i.line&&i.ch>=n.to||null==n.from&&a!=i.line||null!=n.from&&a==o.line&&n.from>=o.ch||l&&!l(n.marker)||s.push(n.marker.parent||n.marker)}++a}),s},getAllMarks:function(){var n=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;++r)null!=t[r].from&&n.push(t[r].marker)}),n},posFromIndex:function(r){var n,i=this.first,o=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+o;if(r<t)return n=r,!0;r-=t,++i}),_e(this,me(i,n))},indexFromPos:function(e){var t=(e=_e(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new So(ce(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){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new So(ce(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(ve(o,l)){var s=ko(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}(n,wo(this)),n},unlinkDoc:function(e){if(e instanceof wl&&(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),_o(wo(this));break}}if(e.history==this.history){var r=[e.id];Ti(e,function(e){return r.push(e.id)},!0),e.history=new Fi(null),e.history.done=Ii(this.history.done,r),e.history.undone=Ii(this.history.undone,r)}},iterLinkedDocs:function(e){Ti(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):xt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Zn(function(e){var t;("rtl"!=e&&(e="ltr"),e!=this.direction)&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Vn(t=this.cm,function(){Di(t),Xn(t)}))})}),So.prototype.eachLine=So.prototype.iter;var Lo=0;function Mo(e){var i=this;if(To(i),!ot(i,e)&&!kr(i.display,e)){ut(e),x&&(Lo=+new Date);var o=ln(i,e,!0),t=e.dataTransfer.files;if(o&&!i.isReadOnly())if(t&&t.length&&window.FileReader&&window.File)for(var l=t.length,s=Array(l),a=0,r=function(e,r){if(!i.options.allowDropFileTypes||-1!=I(i.options.allowDropFileTypes,e.type)){var n=new FileReader;n.onload=Gn(i,function(){var e=n.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),s[r]=e,++a==l){var t={from:o=_e(i.doc,o),to:o,text:i.doc.splitLines(s.join(i.doc.lineSeparator())),origin:"paste"};no(i.doc,t),Vi(i.doc,bi(o,ki(t)))}}),n.readAsText(e)}},n=0;n<l;++n)r(t[n],n);else{if(i.state.draggingText&&-1<i.doc.sel.contains(o))return i.state.draggingText(e),void setTimeout(function(){return i.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var c;if(i.state.draggingText&&!i.state.draggingText.copy&&(c=i.listSelections()),Ki(i.doc,bi(o,o)),c)for(var h=0;h<c.length;++h)ao(i.doc,"",c[h].anchor,c[h].head,"drag");i.replaceSelection(u,"around","paste"),i.display.input.focus()}}catch(e){}}}}function To(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Ao(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<e.length;n++){var i=e[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation(function(){for(var e=0;e<r.length;e++)t(r[e])})}}var Do=!1;function Fo(){var e;Do||(tt(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ao(Oo)},100))}),tt(window,"blur",function(){return Ao(vn)}),Do=!0)}function Oo(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var No={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:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Eo=0;Eo<10;Eo++)No[Eo+48]=No[Eo+96]=String(Eo);for(var qo=65;qo<=90;qo++)No[qo]=String.fromCharCode(qo);for(var zo=1;zo<=12;zo++)No[zo+111]=No[zo+63235]="F"+zo;var Wo={};function Po(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var s=o[l];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))r=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Ho(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=X(r.split(" "),Po),o=0;o<i.length;o++){var l=void 0,s=void 0;l=o==i.length-1?(s=i.join(" "),n):(s=i.slice(0,o+1).join(" "),"...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var u in t)e[u]=t[u];return e}function Io(e,t,r,n){var i=(t=jo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Io(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=Io(e,t.fallthrough[o],r,n);if(l)return l}}}function Ro(e){var t="string"==typeof e?e:No[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Bo(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function $o(e,t){if(m&&34==e.keyCode&&e.char)return!1;var r=No[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),Bo(r,e,t))}function jo(e){return"string"==typeof e?Wo[e]:e}function Uo(t,e){for(var r=t.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=e(r[i]);n.length&&ve(o.from,Z(n).to)<=0;){var l=n.pop();if(ve(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Vn(t,function(){for(var e=n.length-1;0<=e;e--)ao(t.doc,"",n[e].from,n[e].to,"+delete");Sn(t)})}function Vo(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Go(e,t,r){var n=Vo(e,t.ch,r);return null==n?null:new me(t.line,n,r<0?"after":"before")}function Ko(e,t,r,n,i){if(e){var o=Je(r,t.doc.direction);if(o){var l,s=i<0?Z(o):o[0],a=i<0==(1==s.level)?"after":"before";if(0<s.level||"rtl"==t.doc.direction){var u=Dr(t,r);l=i<0?r.text.length-1:0;var c=Fr(t,u,l).top;l=le(function(e){return Fr(t,u,e).top==c},i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Vo(r,l,1))}else l=i<0?s.to:s.from;return new me(n,l,a)}}return new me(n,i<0?r.text.length:0,i<0?"before":"after")}Wo.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"},Wo.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"},Wo.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"},Wo.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"]},Wo.default=k?Wo.macDefault:Wo.pcDefault;var Zo={selectAll:to,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),$)},killLine:function(r){return Uo(r,function(e){if(e.empty()){var t=ae(r.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<r.lastLine()?{from:e.head,to:me(e.head.line+1,0)}:{from:e.head,to:me(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Uo(t,function(e){return{from:me(e.from().line,0),to:_e(t.doc,me(e.to().line+1,0))}})},delLineLeft:function(e){return Uo(e,function(e){return{from:me(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(r){return Uo(r,function(e){var t=r.charCoords(e.head,"div").top+5;return{from:r.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return Uo(n,function(e){var t=n.charCoords(e.head,"div").top+5,r=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:r}})},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(me(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(me(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Xo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Yo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var r=ae(e.doc,t),n=function(e){for(var t;t=He(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=de(n));return Ko(!0,e,r,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div")},U)},goLineLeft:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:0,top:t},"div")},U)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,r=n.coordsChar({left:0,top:t},"div");return r.ch<n.getLine(r.line).search(/\S/)?Yo(n,e.head):r},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,"char")},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=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=P(e.getLine(o.line),o.ch,n);t.push(K(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(l){return Vn(l,function(){for(var e=l.listSelections(),t=[],r=0;r<e.length;r++)if(e[r].empty()){var n=e[r].head,i=ae(l.doc,n.line).text;if(i)if(n.ch==i.length&&(n=new me(n.line,n.ch-1)),0<n.ch)n=new me(n.line,n.ch+1),l.replaceRange(i.charAt(n.ch-1)+i.charAt(n.ch-2),me(n.line,n.ch-2),n,"+transpose");else if(n.line>l.doc.first){var o=ae(l.doc,n.line-1).text;o&&(n=new me(n.line,1),l.replaceRange(i.charAt(0)+l.doc.lineSeparator()+o.charAt(o.length-1),me(n.line-1,o.length-1),n,"+transpose"))}t.push(new vi(n,n))}l.setSelections(t)})},newlineAndIndent:function(n){return Vn(n,function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange(n.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=n.listSelections();for(var r=0;r<e.length;r++)n.indentLine(e[r].from().line,null,!0);Sn(n)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xo(e,t){var r=ae(e.doc,t),n=Be(r);return n!=r&&(t=de(n)),Ko(!0,e,n,t,1)}function Yo(e,t){var r=Xo(e,t.line),n=ae(e.doc,r.line),i=Je(n,e.doc.direction);if(i&&0!=i[0].level)return r;var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return me(r.line,l?0:o,r.sticky)}function Qo(e,t,r){if("string"==typeof t&&!(t=Zo[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=B}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var Jo=new H;function el(e,t,r,n){var i=e.state.keySeq;if(i){if(Ro(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Jo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),tl(e,i+" "+t,r,n))return!0}return tl(e,t,r,n)}function tl(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Io(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Io(t,e.options.extraKeys,r,e)||Io(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&sr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(ut(r),fn(e)),!!i}function rl(t,e){var r=$o(e,!0);return!!r&&(e.shiftKey&&!t.state.keySeq?el(t,"Shift-"+r,e,function(e){return Qo(t,e,!0)})||el(t,r,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Qo(t,e)}):el(t,r,e,function(e){return Qo(t,e)}))}var nl=null;function il(e){var t=this;if(t.curOp.focus=O(),!ot(t,e)){x&&w<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=rl(t,e);m&&(nl=n?r:null,!n&&88==r&&!_t&&(k?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(L(t,"CodeMirror-crosshair"),nt(document,"keyup",r),nt(document,"mouseover",r))}N(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r)}(t)}}function ol(e){16==e.keyCode&&(this.doc.sel.shift=!1),ot(this,e)}function ll(e){var t=this;if(!(kr(t.display,e)||ot(t,e)||e.ctrlKey&&!e.altKey||k&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(m&&r==nl)return nl=null,void ut(e);if(!m||e.which&&!(e.which<10)||!rl(t,e)){var i,o=String.fromCharCode(null==n?r:n);if("\b"!=o)if(!el(i=t,"'"+o+"'",e,function(e){return Qo(i,e,!0)}))t.display.input.onKeyPress(e)}}}var sl,al,ul=function(e,t,r){this.time=e,this.pos=t,this.button=r};function cl(e){var t=this,r=t.display;if(!(ot(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,kr(r,e))b||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));else if(!fl(t,e)){var n,i,o,l=ln(t,e),s=pt(e),a=l?(n=l,i=s,o=+new Date,al&&al.compare(o,n,i)?(sl=al=null,"triple"):sl&&sl.compare(o,n,i)?(al=new ul(o,n,i),sl=null,"double"):(sl=new ul(o,n,i),al=null,"single")):"single";window.focus(),1==s&&t.state.selectingText&&t.state.selectingText(e),l&&function(r,e,n,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return el(r,Bo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=Zo[e]),!e)return!1;var t=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),t=e(r,n)!=B}finally{r.state.suppressEdits=!1}return t})}(t,s,l,a,e)||(1==s?l?function(e,t,r,n){x?setTimeout(z(pn,e),0):e.curOp.focus=O();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=f?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=k?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(k?r.altKey:r.ctrlKey));return i}(e,r,n),l=e.doc.sel;e.options.dragDrop&&vt&&!e.isReadOnly()&&"single"==r&&-1<(i=l.contains(t))&&(ve((i=l.ranges[i]).from(),t)<0||0<t.xRel)&&(0<ve(i.to(),t)||t.xRel<0)?function(t,r,n,i){var o=t.display,l=!1,s=Gn(t,function(e){b&&(o.scroller.draggable=!1),t.state.draggingText=!1,nt(o.wrapper.ownerDocument,"mouseup",s),nt(o.wrapper.ownerDocument,"mousemove",a),nt(o.scroller,"dragstart",u),nt(o.scroller,"drop",s),l||(ut(e),i.addNew||Bi(t.doc,n,null,null,i.extend),b||x&&9==w?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),a=function(e){l=l||10<=Math.abs(r.clientX-e.clientX)+Math.abs(r.clientY-e.clientY)},u=function(){return l=!0};b&&(o.scroller.draggable=!0);(t.state.draggingText=s).copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();tt(o.wrapper.ownerDocument,"mouseup",s),tt(o.wrapper.ownerDocument,"mousemove",a),tt(o.scroller,"dragstart",u),tt(o.scroller,"drop",s),gn(t),setTimeout(function(){return o.input.focus()},20)}(e,n,t,o):function(m,e,v,y){var l=m.display,b=m.doc;ut(e);var k,x,w=b.sel,t=w.ranges;y.addNew&&!y.extend?(x=b.sel.contains(v),k=-1<x?t[x]:new vi(v,v)):(k=b.sel.primary(),x=b.sel.primIndex);if("rectangle"==y.unit)y.addNew||(k=new vi(v,v)),v=ln(m,e,!0,!0),x=-1;else{var r=hl(m,v,y.unit);k=y.extend?Ri(k,r.anchor,r.head,y.extend):r}y.addNew?-1==x?(x=t.length,Gi(b,yi(m,t.concat([k]),x),{scroll:!1,origin:"*mouse"})):1<t.length&&t[x].empty()&&"char"==y.unit&&!y.extend?(Gi(b,yi(m,t.slice(0,x).concat(t.slice(x+1)),0),{scroll:!1,origin:"*mouse"}),w=b.sel):ji(b,x,k,j):(Gi(b,new mi([k],x=0),j),w=b.sel);var _=v;function s(e){if(0!=ve(_,e))if(_=e,"rectangle"==y.unit){for(var t=[],r=m.options.tabSize,n=P(ae(b,v.line).text,v.ch,r),i=P(ae(b,e.line).text,e.ch,r),o=Math.min(n,i),l=Math.max(n,i),s=Math.min(v.line,e.line),a=Math.min(m.lastLine(),Math.max(v.line,e.line));s<=a;s++){var u=ae(b,s).text,c=V(u,o,r);o==l?t.push(new vi(me(s,c),me(s,c))):u.length>c&&t.push(new vi(me(s,c),me(s,V(u,l,r))))}t.length||t.push(new vi(v,v)),Gi(b,yi(m,w.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),m.scrollIntoView(e)}else{var h,d=k,f=hl(m,e,y.unit),p=d.anchor;p=0<ve(f.anchor,p)?(h=f.head,xe(d.from(),f.anchor)):(h=f.anchor,ke(d.to(),f.head));var g=w.ranges.slice(0);g[x]=function(e,t){var r=t.anchor,n=t.head,i=ae(e.doc,r.line);if(0==ve(r,n)&&r.sticky==n.sticky)return t;var o=Je(i);if(!o)return t;var l=Ye(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,u=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(n.line!=r.line)a=0<(n.line-r.line)*("ltr"==e.doc.direction?1:-1);else{var c=Ye(o,n.ch,n.sticky),h=c-l||(n.ch-r.ch)*(1==s.level?-1:1);a=c==u-1||c==u?h<0:0<h}var d=o[u+(a?-1:0)],f=a==(1==d.level),p=f?d.from:d.to,g=f?"after":"before";return r.ch==p&&r.sticky==g?t:new vi(new me(r.line,p,g),n)}(m,new vi(_e(b,p),h)),Gi(b,yi(m,g,x),j)}}var a=l.wrapper.getBoundingClientRect(),u=0;function n(e){m.state.selectingText=!1,u=1/0,ut(e),l.input.focus(),nt(l.wrapper.ownerDocument,"mousemove",i),nt(l.wrapper.ownerDocument,"mouseup",o),b.history.lastSelOrigin=null}var i=Gn(m,function(e){0!==e.buttons&&pt(e)?function e(t){var r=++u;var n=ln(m,t,!0,"rectangle"==y.unit);if(!n)return;if(0!=ve(n,_)){m.curOp.focus=O(),s(n);var i=kn(l,b);(n.line>=i.to||n.line<i.from)&&setTimeout(Gn(m,function(){u==r&&e(t)}),150)}else{var o=t.clientY<a.top?-20:t.clientY>a.bottom?20:0;o&&setTimeout(Gn(m,function(){u==r&&(l.scroller.scrollTop+=o,e(t))}),50)}}(e):n(e)}),o=Gn(m,n);m.state.selectingText=o,tt(l.wrapper.ownerDocument,"mousemove",i),tt(l.wrapper.ownerDocument,"mouseup",o)}(e,n,t,o)}(t,l,a,e):ft(e)==r.scroller&&ut(e):2==s?(l&&Bi(t.doc,l),setTimeout(function(){return r.input.focus()},20)):3==s&&(_?t.display.input.onContextMenu(e):gn(t)))}}function hl(e,t,r){if("char"==r)return new vi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new vi(me(t.line,0),_e(e.doc,me(t.line+1,0)));var n=r(e,t);return new vi(n.from,n.to)}function dl(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ut(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!st(e,r))return ht(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var u=l.gutters.childNodes[a];if(u&&u.getBoundingClientRect().right>=i)return it(e,r,e,fe(e.doc,o),e.options.gutters[a],t),ht(t)}}function fl(e,t){return dl(e,t,"gutterClick",!0)}function pl(e,t){var r,n;kr(e.display,t)||(n=t,st(r=e,"gutterContextMenu")&&dl(r,n,"gutterContextMenu",!1))||(ot(e,t,"contextmenu")||_||e.display.input.onContextMenu(t))}function gl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Pr(e)}ul.prototype.compare=function(e,t,r){return this.time+400>e&&0==ve(t,this.pos)&&r==this.button};var ml={toString:function(){return"CodeMirror.Init"}},vl={},yl={};function bl(e){ui(e),Xn(e),xn(e)}function kl(e,t,r){if(!t!=!(r&&r!=ml)){var n=e.display.dragFunctions,i=t?tt:nt;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function xl(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Ze(e)),on(e),Xn(e),Pr(e),setTimeout(function(){return qn(e)},100)}function wl(e,t){var r=this;if(!(this instanceof wl))return new wl(e,t);this.options=t=t?W(t):{},W(vl,t,!1),ci(t);var n=t.value;"string"==typeof n?n=new So(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new wl.inputStyles[t.inputStyle](this),o=this.display=new se(e,n,i);for(var l in ui(o.wrapper.CodeMirror=this),gl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Pn(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&&!d&&o.input.focus(),x&&w<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(i){var o=i.display;tt(o.scroller,"mousedown",Gn(i,cl)),tt(o.scroller,"dblclick",x&&w<11?Gn(i,function(e){if(!ot(i,e)){var t=ln(i,e);if(t&&!fl(i,e)&&!kr(i.display,e)){ut(e);var r=i.findWordAt(t);Bi(i.doc,r.anchor,r.head)}}}):function(e){return ot(i,e)||ut(e)});tt(o.scroller,"contextmenu",function(e){return pl(i,e)});var r,n={end:0};function l(){o.activeTouch&&(r=setTimeout(function(){return o.activeTouch=null},1e3),(n=o.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return 400<r*r+n*n}tt(o.scroller,"touchstart",function(e){if(!ot(i,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!fl(i,e)){o.input.ensurePolled(),clearTimeout(r);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-n.end<=300?n:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),tt(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),tt(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!kr(o,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var r,n=i.coordsChar(o.activeTouch,"page");r=!t.prev||s(t,t.prev)?new vi(n,n):!t.prev.prev||s(t,t.prev.prev)?i.findWordAt(n):new vi(me(n.line,0),_e(i.doc,me(n.line+1,0))),i.setSelection(r.anchor,r.head),i.focus(),ut(e)}l()}),tt(o.scroller,"touchcancel",l),tt(o.scroller,"scroll",function(){o.scroller.clientHeight&&(An(i,o.scroller.scrollTop),Fn(i,o.scroller.scrollLeft,!0),it(i,"scroll",i))}),tt(o.scroller,"mousewheel",function(e){return gi(i,e)}),tt(o.scroller,"DOMMouseScroll",function(e){return gi(i,e)}),tt(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(e){ot(i,e)||dt(e)},over:function(e){ot(i,e)||(!function(e,t){var r=ln(e,t);if(r){var n=document.createDocumentFragment();cn(e,r,n),e.display.dragCursor||(e.display.dragCursor=D("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,n)}}(i,e),dt(e))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-Lo<100))dt(t);else if(!ot(e,t)&&!kr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!a)){var r=D("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",m&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),m&&r.parentNode.removeChild(r)}}(i,e)},drop:Gn(i,Mo),leave:function(e){ot(i,e)||To(i)}};var e=o.input.getField();tt(e,"keyup",function(e){return ol.call(i,e)}),tt(e,"keydown",Gn(i,il)),tt(e,"keypress",Gn(i,ll)),tt(e,"focus",function(e){return mn(i,e)}),tt(e,"blur",function(e){return vn(i,e)})}(this),Fo(),In(this),this.curOp.forceUpdate=!0,Ai(this,n),t.autofocus&&!d||this.hasFocus()?setTimeout(z(mn,this),20):vn(this),yl)yl.hasOwnProperty(l)&&yl[l](r,t[l],ml);wn(this),t.finishInit&&t.finishInit(this);for(var s=0;s<_l.length;++s)_l[s](r);Rn(this),b&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}wl.defaults=vl,wl.optionHandlers=yl;var _l=[];function Cl(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Ht(e,t).state:r="prev");var l=e.options.tabSize,s=ae(o,t),a=P(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==B||150<u)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?P(ae(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var h="",d=0;if(e.options.indentWithTabs)for(var f=Math.floor(u/l);f;--f)d+=l,h+="\t";if(d<u&&(h+=K(u-d)),h!=c)return ao(o,h,me(t,0),me(t,c.length),"+input"),!(s.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var m=me(t,c.length);ji(o,p,new vi(m,m));break}}}wl.defineInitHook=function(e){return _l.push(e)};var Sl=null;function Ll(e){Sl=e}function Ml(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l=+new Date-200,s="paste"==i||e.state.pasteIncoming>l,a=xt(t),u=null;if(s&&1<n.ranges.length)if(Sl&&Sl.text.join("\n")==t){if(n.ranges.length%Sl.text.length==0){u=[];for(var c=0;c<Sl.text.length;c++)u.push(o.splitLines(Sl.text[c]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(u=X(a,function(e){return[e]}));for(var h=e.curOp.updateInput,d=n.ranges.length-1;0<=d;d--){var f=n.ranges[d],p=f.from(),g=f.to();f.empty()&&(r&&0<r?p=me(p.line,p.ch-r):e.state.overwrite&&!s?g=me(g.line,Math.min(ae(o,g.line).text.length,g.ch+Z(a).length)):s&&Sl&&Sl.lineWise&&Sl.text.join("\n")==t&&(p=g=me(p.line,0)));var m={from:p,to:g,text:u?u[d%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming>l?"cut":"+input")};no(e.doc,m),sr(e,"inputRead",e,m)}t&&!s&&Al(e,t),Sn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Tl(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Vn(t,function(){return Ml(t,r,0,null,"paste")}),!0}function Al(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;0<=n;n--){var i=r.ranges[n];if(!(100<i.head.ch||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(-1<t.indexOf(o.electricChars.charAt(s))){l=Cl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Cl(e,i.head.line,"smart"));l&&sr(e,"electricInput",e,i.head.line)}}}function Dl(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:me(i,0),head:me(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Fl(e,t,r,n){e.setAttribute("autocorrect",!!r),e.setAttribute("autocapitalize",!!n),e.setAttribute("spellcheck",!!t)}function Ol(){var e=D("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=D("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return b?e.style.width="1000px":e.setAttribute("wrap","off"),c&&(e.style.border="1px solid black"),Fl(e),t}function Nl(n,i,o,e,l){var t=i,r=o,s=ae(n,i.line);function a(e){var t,r;if(null==(t=l?function(t,r,s,e){var a=Je(r,t.doc.direction);if(!a)return Go(r,s,e);s.ch>=r.text.length?(s.ch=r.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var n=Ye(a,s.ch,s.sticky),i=a[n];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return Go(r,s,e);var o,u=function(e,t){return Vo(r,e instanceof me?e.ch:e,t)},l=function(e){return t.options.lineWrapping?(o=o||Dr(t,r),Xr(t,r,o,e)):{begin:0,end:r.text.length}},c=l("before"==s.sticky?u(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var h=1==i.level==e<0,d=u(s,h?1:-1);if(null!=d&&(h?d<=i.to&&d<=c.end:d>=i.from&&d>=c.begin)){var f=h?"before":"after";return new me(s.line,d,f)}}var p=function(e,t,r){for(var n=function(e,t){return t?new me(s.line,u(e,1),"before"):new me(s.line,e,"after")};0<=e&&e<a.length;e+=t){var i=a[e],o=0<t==(1!=i.level),l=o?r.begin:u(r.end,-1);if(i.from<=l&&l<i.to)return n(l,o);if(l=o?i.from:u(i.to,-1),r.begin<=l&&l<r.end)return n(l,o)}},g=p(n+e,e,c);if(g)return g;var m=0<e?c.end:u(c.begin,-1);return null==m||0<e&&m==r.text.length||!(g=p(0<e?0:a.length-1,e,l(m)))?null:g}(n.cm,s,i,o):Go(s,i,o))){if(e||(r=i.line+o)<n.first||r>=n.first+n.size||(i=new me(r,i.ch,i.sticky),!(s=ae(n,r))))return!1;i=Ko(l,n.cm,s,i.line,o)}else i=t;return!0}if("char"==e)a();else if("column"==e)a(!0);else if("word"==e||"group"==e)for(var u=null,c="group"==e,h=n.cm&&n.cm.getHelper(i,"wordChars"),d=!0;!(o<0)||a(!d);d=!1){var f=s.text.charAt(i.ch)||"\n",p=te(f,h)?"w":c&&"\n"==f?"n":!c||/\s/.test(f)?null:"p";if(!c||d||p||(p="s"),u&&u!=p){o<0&&(o=1,a(),i.sticky="after");break}if(p&&(u=p),0<o&&!a(!d))break}var g=Ji(n,i,t,r,!0);return ye(t,g)&&(g.hitSide=!0),g}function El(e,t,r,n){var i,o,l=e.doc,s=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(a-.5*Jr(e.display),3);i=(0<r?t.bottom:t.top)+r*u}else"line"==n&&(i=0<r?t.bottom+3:t.top-3);for(;(o=Kr(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var ql=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 zl(e,t){var r=Ar(e,t.line);if(!r||r.hidden)return null;var n=ae(e.doc,t.line),i=Mr(r,n,t.line),o=Je(n,e.doc.direction),l="left";o&&(l=Ye(o,t.ch)%2?"right":"left");var s=Er(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Wl(e,t){return t&&(e.bad=!0),e}function Pl(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Wl(e.clipPos(me(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Hl(o,t,r)}}function Hl(u,e,t){var r=u.text.firstChild,n=!1;if(!e||!F(r,e))return Wl(me(de(u.line),0),!0);if(e==r&&(n=!0,e=r.childNodes[t],t=0,!e)){var i=u.rest?Z(u.rest):u.line;return Wl(me(de(i),i.text.length),n)}var o=3==e.nodeType?e:null,l=e;for(o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,t&&(t=o.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var c=u.measure,h=c.maps;function s(e,t,r){for(var n=-1;n<(h?h.length:0);n++)for(var i=n<0?c.map:h[n],o=0;o<i.length;o+=3){var l=i[o+2];if(l==e||l==t){var s=de(n<0?u.line:u.rest[n]),a=i[o]+r;return(r<0||l!=e)&&(a=i[o+(r?1:0)]),me(s,a)}}}var a=s(o,l,t);if(a)return Wl(a,n);for(var d=l.nextSibling,f=o?o.nodeValue.length-t:0;d;d=d.nextSibling){if(a=s(d,d.firstChild,0))return Wl(me(a.line,a.ch-f),n);f+=d.textContent.length}for(var p=l.previousSibling,g=t;p;p=p.previousSibling){if(a=s(p,p.firstChild,-1))return Wl(me(a.line,a.ch+g),n);g+=p.textContent.length}}ql.prototype.init=function(e){var t=this,l=this,s=l.cm,a=l.div=e.lineDiv;function r(e){if(!ot(s,e)){if(s.somethingSelected())Ll({lineWise:!1,text:s.getSelections()}),"cut"==e.type&&s.replaceSelection("",null,"cut");else{if(!s.options.lineWiseCopyCut)return;var t=Dl(s);Ll({lineWise:!0,text:t.text}),"cut"==e.type&&s.operation(function(){s.setSelections(t.ranges,0,$),s.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=Sl.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var n=Ol(),i=n.firstChild;s.display.lineSpace.insertBefore(n,s.display.lineSpace.firstChild),i.value=Sl.text.join("\n");var o=document.activeElement;q(i),setTimeout(function(){s.display.lineSpace.removeChild(n),o.focus(),o==a&&l.showPrimarySelection()},50)}}Fl(a,s.options.spellcheck,s.options.autocorrect,s.options.autocapitalize),tt(a,"paste",function(e){ot(s,e)||Tl(e,s)||w<=11&&setTimeout(Gn(s,function(){return t.updateFromDOM()}),20)}),tt(a,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),tt(a,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),tt(a,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),tt(a,"touchstart",function(){return l.forceCompositionEnd()}),tt(a,"input",function(){t.composing||t.readFromDOMSoon()}),tt(a,"copy",r),tt(a,"cut",r)},ql.prototype.prepareSelection=function(){var e=un(this.cm,!1);return e.focus=this.cm.state.focused,e},ql.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ql.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ql.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=Pl(t,e.anchorNode,e.anchorOffset),l=Pl(t,e.focusNode,e.focusOffset);if(!o||o.bad||!l||l.bad||0!=ve(xe(o,l),n)||0!=ve(ke(o,l),i)){var s=t.display.view,a=n.line>=t.display.viewFrom&&zl(t,n)||{node:s[0].measure.map[2],offset:0},u=i.line<t.display.viewTo&&zl(t,i);if(!u){var c=s[s.length-1].measure,h=c.maps?c.maps[c.maps.length-1]:c.map;u={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(a&&u){var d,f=e.rangeCount&&e.getRangeAt(0);try{d=S(a.node,a.offset,u.offset,u.node)}catch(e){}d&&(!g&&t.state.focused?(e.collapse(a.node,a.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),f&&null==e.anchorNode?e.addRange(f):g&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},ql.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)},ql.prototype.showMultipleSelections=function(e){T(this.cm.display.cursorDiv,e.cursors),T(this.cm.display.selectionDiv,e.selection)},ql.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ql.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return F(this.div,t)},ql.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ql.prototype.blur=function(){this.div.blur()},ql.prototype.getField=function(){return this.div},ql.prototype.supportsTouch=function(){return!0},ql.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Vn(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))})},ql.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ql.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(h&&l&&this.cm.options.gutters.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Pl(t,e.anchorNode,e.anchorOffset),n=Pl(t,e.focusNode,e.focusOffset);r&&n&&Vn(t,function(){Gi(t.doc,bi(r,n),$),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},ql.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),l=o.from(),s=o.to();if(0==l.ch&&l.line>n.firstLine()&&(l=me(l.line-1,ae(n.doc,l.line-1).length)),s.ch==ae(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=me(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;r=l.line==i.viewFrom||0==(e=sn(n,l.line))?(t=de(i.view[0].line),i.view[0].node):(t=de(i.view[e].line),i.view[e-1].node.nextSibling);var a,u,c=sn(n,s.line);if(u=c==i.view.length-1?(a=i.viewTo-1,i.lineDiv.lastChild):(a=de(i.view[c+1].line)-1,i.view[c+1].node.previousSibling),!r)return!1;for(var h=n.doc.splitLines(function(a,e,t,u,c){var r="",h=!1,d=a.doc.lineSeparator(),f=!1;function p(){h&&(r+=d,f&&(r+=d),h=f=!1)}function g(e){e&&(p(),r+=e)}function m(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void g(t);var r,n=e.getAttribute("cm-marker");if(n){var i=a.findMarks(me(u,0),me(c+1,0),(s=+n,function(e){return e.id==s}));return void(i.length&&(r=i[0].find(0))&&g(ue(a.doc,r.from,r.to).join(d)))}if("false"==e.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;o&&p();for(var l=0;l<e.childNodes.length;l++)m(e.childNodes[l]);/^(pre|p)$/i.test(e.nodeName)&&(f=!0),o&&(h=!0)}else 3==e.nodeType&&g(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var s}for(;m(e),e!=t;)e=e.nextSibling,f=!1;return r}(n,r,u,t,a)),d=ue(n.doc,me(t,0),me(a,ae(n.doc,a).text.length));1<h.length&&1<d.length;)if(Z(h)==Z(d))h.pop(),d.pop(),a--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),t++}for(var f=0,p=0,g=h[0],m=d[0],v=Math.min(g.length,m.length);f<v&&g.charCodeAt(f)==m.charCodeAt(f);)++f;for(var y=Z(h),b=Z(d),k=Math.min(y.length-(1==h.length?f:0),b.length-(1==d.length?f:0));p<k&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==h.length&&1==d.length&&t==l.line)for(;f&&f>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)f--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var x=me(t,f),w=me(a,d.length?Z(d).length-p:0);return 1<h.length||h[0]||ve(x,w)?(ao(n.doc,h,x,w,"+input"),!0):void 0},ql.prototype.ensurePolled=function(){this.forceCompositionEnd()},ql.prototype.reset=function(){this.forceCompositionEnd()},ql.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ql.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))},ql.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Vn(this.cm,function(){return Xn(e.cm)})},ql.prototype.setUneditable=function(e){e.contentEditable="false"},ql.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Gn(this.cm,Ml)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ql.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},ql.prototype.onContextMenu=function(){},ql.prototype.resetPosition=function(){},ql.prototype.needsContentAttribute=!0;var Il,Rl,Bl,$l=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new H,this.hasSelection=!1,this.composing=null};$l.prototype.init=function(r){var e=this,n=this,i=this.cm;this.createField(r);var o=this.textarea;function t(e){if(!ot(i,e)){if(i.somethingSelected())Ll({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Dl(i);Ll({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,$):(n.prevInput="",o.value=t.text.join("\n"),q(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}r.wrapper.insertBefore(this.wrapper,r.wrapper.firstChild),c&&(o.style.width="0px"),tt(o,"input",function(){x&&9<=w&&e.hasSelection&&(e.hasSelection=null),n.poll()}),tt(o,"paste",function(e){ot(i,e)||Tl(e,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())}),tt(o,"cut",t),tt(o,"copy",t),tt(r.scroller,"paste",function(e){if(!kr(r,e)&&!ot(i,e)){if(!o.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var t=new Event("paste");t.clipboardData=e.clipboardData,o.dispatchEvent(t)}}),tt(r.lineSpace,"selectstart",function(e){kr(r,e)||ut(e)}),tt(o,"compositionstart",function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),tt(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},$l.prototype.createField=function(e){this.wrapper=Ol(),this.textarea=this.wrapper.firstChild},$l.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=un(e);if(e.options.moveInputWithCursor){var i=Ur(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},$l.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},$l.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&q(this.textarea),x&&9<=w&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",x&&9<=w&&(this.hasSelection=null))}},$l.prototype.getField=function(){return this.textarea},$l.prototype.supportsTouch=function(){return!1},$l.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!d||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},$l.prototype.blur=function(){this.textarea.blur()},$l.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$l.prototype.receivedFocus=function(){this.slowPoll()},$l.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},$l.prototype.fastPoll=function(){var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))})},$l.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||wt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(x&&9<=w&&this.hasSelection===i||k&&/[\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||n||(n=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,s=Math.min(n.length,i.length);l<s&&n.charCodeAt(l)==i.charCodeAt(l);)++l;return Vn(t,function(){Ml(t,i.slice(l),n.length-l,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?r.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},$l.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$l.prototype.onKeyPress=function(){x&&9<=w&&(this.hasSelection=null),this.fastPoll()},$l.prototype.onContextMenu=function(e){var r=this,n=r.cm,i=n.display,o=r.textarea;r.contextMenuPending&&r.contextMenuPending();var t=ln(n,e),l=i.scroller.scrollTop;if(t&&!m){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(t)&&Gn(n,Gi)(n.doc,bi(t),$);var s,a=o.style.cssText,u=r.wrapper.style.cssText,c=r.wrapper.offsetParent.getBoundingClientRect();if(r.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: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",b&&(s=window.scrollY),i.input.focus(),b&&window.scrollTo(null,s),i.input.reset(),n.somethingSelected()||(o.value=r.prevInput=" "),r.contextMenuPending=f,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),x&&9<=w&&d(),_){dt(e);var h=function(){nt(window,"mouseup",h),setTimeout(f,20)};tt(window,"mouseup",h)}else setTimeout(f,50)}function d(){if(null!=o.selectionStart){var e=n.somethingSelected(),t=""+(e?o.value:"");o.value="",o.value=t,r.prevInput=e?"":"",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=n.doc.sel}}function f(){if(r.contextMenuPending==f&&(r.contextMenuPending=!1,r.wrapper.style.cssText=u,o.style.cssText=a,x&&w<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=l),null!=o.selectionStart)){(!x||x&&w<9)&&d();var e=0,t=function(){i.selForContextMenu==n.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&""==r.prevInput?Gn(n,to)(n):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},$l.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},$l.prototype.setUneditable=function(){},$l.prototype.needsContentAttribute=!1,function(i){var o=i.optionHandlers;function e(e,t,n,r){i.defaults[e]=t,n&&(o[e]=r?function(e,t,r){r!=ml&&n(e,t,r)}:n)}i.defineOption=e,i.Init=ml,e("value","",function(e,t){return e.setValue(t)},!0),e("mode",null,function(e,t){e.doc.modeOption=t,Ci(e)},!0),e("indentUnit",2,Ci,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(e){Si(e),Pr(e),Xn(e)},!0),e("lineSeparator",null,function(e,n){if(e.doc.lineSep=n){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var r=e.text.indexOf(n,t);if(-1==r)break;t=r+n.length,i.push(me(o,r))}o++});for(var t=i.length-1;0<=t;t--)ao(e.doc,n,i[t],me(i[t].line,i[t].ch+n.length))}}),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=ml&&e.refresh()}),e("specialCharPlaceholder",Qt,function(e){return e.refresh()},!0),e("electricChars",!0),e("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),e("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),e("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),e("rtlMoveVisually",!p),e("wholeLineUpdateBefore",!0),e("theme","default",function(e){gl(e),bl(e)},!0),e("keyMap","default",function(e,t,r){var n=jo(t),i=r!=ml&&jo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,xl,!0),e("gutters",[],function(e){ci(e.options),bl(e)},!0),e("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?rn(e.display)+"px":"0",e.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(e){return qn(e)},!0),e("scrollbarStyle","native",function(e){Pn(e),qn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),e("lineNumbers",!1,function(e){ci(e.options),bl(e)},!0),e("firstLineNumber",1,bl,!0),e("lineNumberFormatter",function(e){return e},bl,!0),e("showCursorWhenSelecting",!1,an,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("selectionsMayTouch",!1),e("readOnly",!1,function(e,t){"nocursor"==t&&(vn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),e("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),e("dragDrop",!0,kl),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,an,!0),e("singleCursorHeightPerLine",!0,an,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Si,!0),e("addModeClass",!1,Si,!0),e("pollInterval",100),e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),e("historyEventDelay",1250),e("viewportMargin",10,function(e){return e.refresh()},!0),e("maxHighlightLength",1e4,Si,!0),e("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),e("autofocus",null),e("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),e("phrases",null)}(wl),Rl=(Il=wl).optionHandlers,Bl=Il.helpers={},Il.prototype={constructor:Il,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];r[e]==t&&"mode"!=e||(r[e]=t,Rl.hasOwnProperty(e)&&Gn(this,Rl[e])(this,t,n),it(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"](jo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Kn(function(e,t){var r=e.token?e:Il.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:r,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,Xn(this)}),removeOverlay:Kn(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Xn(this)}}),indentLine:Kn(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),pe(this.doc,e)&&Cl(this,e,t,r)}),indentSelection:Kn(function(e){for(var t=this,r=this.doc.sel.ranges,n=-1,i=0;i<r.length;i++){var o=r[i];if(o.empty())o.head.line>n&&(Cl(t,o.head.line,e,!0),n=o.head.line,i==t.doc.sel.primIndex&&Sn(t));else{var l=o.from(),s=o.to(),a=Math.max(n,l.line);n=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var u=a;u<n;++u)Cl(t,u,e);var c=t.doc.sel.ranges;0==l.ch&&r.length==c.length&&0<c[i].from().ch&&ji(t.doc,i,new vi(l,c[i].to()),$)}}}),getTokenAt:function(e,t){return jt(this,e,t)},getLineTokens:function(e,t){return jt(this,me(e),t,!0)},getTokenTypeAt:function(e){e=_e(this.doc,e);var t,r=Pt(this,ae(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Il.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Bl.hasOwnProperty(t))return r;var n=Bl[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var l=n[i[t][o]];l&&r.push(l)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var s=0;s<n._global.length;s++){var a=n._global[s];a.pred(i,this)&&-1==I(r,a.val)&&r.push(a.val)}return r},getStateAfter:function(e,t){var r=this.doc;return Ht(this,(e=we(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Ur(this,null==e?r.head:"object"==typeof e?_e(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return jr(this,_e(this.doc,e),t||"page")},coordsChar:function(e,t){return Kr(this,(e=$r(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=$r(this,{top:e,left:0},t||"page").top,fe(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:o<e&&(e=o,i=!0),n=ae(this.doc,e)}else n=e;return Br(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Ge(n):0)},defaultTextHeight:function(){return Jr(this.display)},defaultCharWidth:function(){return en(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,l,s,a=this.display,u=(e=Ur(this,_e(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)u=e.top;else if("above"==n||"near"==n){var h=Math.max(a.wrapper.clientHeight,this.doc.height),d=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>h)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=h&&(u=e.bottom),c+t.offsetWidth>d&&(c=d-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,l={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(s=_n(o,l)).scrollTop&&An(o,s.scrollTop),null!=s.scrollLeft&&Fn(o,s.scrollLeft))},triggerOnKeyDown:Kn(il),triggerOnKeyPress:Kn(ll),triggerOnKeyUp:ol,triggerOnMouseDown:Kn(cl),execCommand:function(e){if(Zo.hasOwnProperty(e))return Zo[e].call(null,this)},triggerElectric:Kn(function(e){Al(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=_e(this.doc,e),l=0;l<t&&!(o=Nl(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:Kn(function(t,r){var n=this;this.extendSelectionsBy(function(e){return n.display.shift||n.doc.extend||e.empty()?Nl(n.doc,e.head,t,r,n.options.rtlMoveVisually):t<0?e.from():e.to()},U)}),deleteH:Kn(function(r,n){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Uo(this,function(e){var t=Nl(i,e.head,r,n,!1);return r<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=_e(this.doc,e),s=0;s<t;++s){var a=Ur(this,l,"div");if(null==o?o=a.left:a.left=o,(l=El(this,a,i,r)).hitSide)break}return l},moveV:Kn(function(n,i){var o=this,l=this.doc,s=[],a=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(e){if(a)return n<0?e.from():e.to();var t=Ur(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left);var r=El(o,t,n,i);return"page"==i&&e==l.sel.primary()&&Cn(o,jr(o,r,"div").top-t.top),r},U),s.length)for(var e=0;e<l.sel.ranges.length;e++)l.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=ae(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),l=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};0<r&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new vi(me(e.line,r),me(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),it(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==O()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Kn(function(e,t){Ln(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Cr(this)-this.display.barHeight,width:e.scrollWidth-Cr(this)-this.display.barWidth,clientHeight:Lr(this),clientWidth:Sr(this)}},scrollIntoView:Kn(function(e,t){var r,n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:me(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,Mn(r=this),r.curOp.scrollToPos=n):Tn(this,e.from,e.to,e.margin)}),setSize:Kn(function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Wr(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){Yn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,it(this,"refresh",this)}),operation:function(e){return Vn(this,e)},startOperation:function(){return In(this)},endOperation:function(){return Rn(this)},refresh:Kn(function(){var e=this.display.cachedTextHeight;Xn(this),this.curOp.forceUpdate=!0,Pr(this),Ln(this,this.doc.scrollLeft,this.doc.scrollTop),si(this),(null==e||.5<Math.abs(e-Jr(this.display)))&&on(this),it(this,"refresh",this)}),swapDoc:Kn(function(e){var t=this.doc;return t.cm=null,Ai(this,e),Pr(this),this.display.input.reset(),Ln(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sr(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}},at(Il),Il.registerHelper=function(e,t,r){Bl.hasOwnProperty(e)||(Bl[e]=Il[e]={_global:[]}),Bl[e][t]=r},Il.registerGlobalHelper=function(e,t,r,n){Il.registerHelper(e,t,n),Bl[e]._global.push({pred:r,val:n})};var jl,Ul="iter insert remove copy getEditor constructor".split(" ");for(var Vl in So.prototype)So.prototype.hasOwnProperty(Vl)&&I(Ul,Vl)<0&&(wl.prototype[Vl]=function(e){return function(){return e.apply(this.doc,arguments)}}(So.prototype[Vl]));return at(So),wl.inputStyles={textarea:$l,contenteditable:ql},wl.defineMode=function(e){wl.defaults.mode||"null"==e||(wl.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),St[e]=t}.apply(this,arguments)},wl.defineMIME=function(e,t){Lt[e]=t},wl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),wl.defineMIME("text/plain","null"),wl.defineExtension=function(e,t){wl.prototype[e]=t},wl.defineDocExtension=function(e,t){So.prototype[e]=t},wl.fromTextArea=function(t,e){if((e=e?W(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var r=O();e.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}function n(){t.value=s.getValue()}var i;if(t.form&&(tt(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}e.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(nt(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=i))}},t.style.display="none";var s=wl(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return s},(jl=wl).off=nt,jl.on=tt,jl.wheelEventPixels=pi,jl.Doc=So,jl.splitLines=xt,jl.countColumn=P,jl.findColumn=V,jl.isWordChar=ee,jl.Pass=B,jl.signal=it,jl.Line=Gt,jl.changeEnd=ki,jl.scrollbarModel=Wn,jl.Pos=me,jl.cmpPos=ve,jl.modes=St,jl.mimeModes=Lt,jl.resolveMode=Mt,jl.getMode=Tt,jl.modeExtensions=At,jl.extendMode=Dt,jl.copyState=Ft,jl.startState=Nt,jl.innerMode=Ot,jl.commands=Zo,jl.keyMap=Wo,jl.keyName=$o,jl.isModifierKey=Ro,jl.lookupKey=Io,jl.normalizeKeyMap=Ho,jl.StringStream=Et,jl.SharedTextMarker=xo,jl.TextMarker=bo,jl.LineWidget=mo,jl.e_preventDefault=ut,jl.e_stopPropagation=ct,jl.e_stop=dt,jl.addClass=N,jl.contains=F,jl.rmClass=L,jl.keyNames=No,wl.version="5.44.0",wl}),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(q){"use strict";q.defineMode("markdown",function(p,x){var w=q.getMode(p,"text/html"),i="null"==w.name;void 0===x.highlightFormatting&&(x.highlightFormatting=!1),void 0===x.maxBlockquoteDepth&&(x.maxBlockquoteDepth=0),void 0===x.taskLists&&(x.taskLists=!1),void 0===x.strikethrough&&(x.strikethrough=!1),void 0===x.emoji&&(x.emoji=!1),void 0===x.fencedCodeBlockHighlighting&&(x.fencedCodeBlockHighlighting=!0),void 0===x.xml&&(x.xml=!0),void 0===x.tokenTypeOverrides&&(x.tokenTypeOverrides={});var _={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(var e in _)_.hasOwnProperty(e)&&x.tokenTypeOverrides[e]&&(_[e]=x.tokenTypeOverrides[e]);var g=/^([*\-_])(?:\s*\1){2,}\s*$/,m=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,C=/^\[(x| )\](?=\s)/i,v=x.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,y=/^ *(?:\={1,}|-{1,})\s*$/,r=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,k=/^\s*\[[^\]]+?\]:.*$/,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 L(e,t,r){return t.f=t.inline=r,r(e,t)}function M(e,t,r){return t.f=t.block=r,r(e,t)}function n(e){if(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==T){var t=i;if(!t){var r=q.innerMode(w,e.htmlState);t="xml"==r.mode.name&&null===r.state.tagStart&&!r.state.context&&r.state.tokenize.isInText}t&&(e.f=F,e.block=l,e.htmlState=null)}return e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function l(e,t){var r,n=e.column()===t.indentation,i=!(r=t.prevLine.stream)||!/\S/.test(r.string),o=t.indentedCode,l=t.prevLine.hr,s=!1!==t.list,a=(t.listStack[t.listStack.length-1]||0)+3;t.indentedCode=!1;var u=t.indentation;if(null===t.indentationDiff&&(t.indentationDiff=t.indentation,s)){for(t.em=!1,t.strong=!1,t.code=!1,t.strikethrough=!1,t.list=null;u<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=u-t.listStack[t.listStack.length-1])}var c=!(i||l||t.prevLine.header||s&&o||t.prevLine.fencedCodeEnd),h=(!1===t.list||l||i)&&t.indentation<=a&&e.match(g),d=null;if(4<=t.indentationDiff&&(o||t.prevLine.fencedCodeEnd||t.prevLine.header||i))return e.skipToEnd(),t.indentedCode=!0,_.code;if(e.eatSpace())return null;if(n&&t.indentation<=a&&(d=e.match(v))&&d[1].length<=6)return t.quote=0,t.header=d[1].length,t.thisLine.header=!0,x.highlightFormatting&&(t.formatting="header"),t.f=t.inline,D(t);if(t.indentation<=a&&e.eat(">"))return t.quote=n?1:t.quote+1,x.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),D(t);if(!h&&!t.setext&&n&&t.indentation<=a&&(d=e.match(m))){var f=d[1]?"ol":"ul";return t.indentation=u+e.current().length,t.list=!0,t.quote=0,t.listStack.push(t.indentation),x.taskLists&&e.match(C,!1)&&(t.taskList=!0),t.f=t.inline,x.highlightFormatting&&(t.formatting=["list","list-"+f]),D(t)}return n&&t.indentation<=a&&(d=e.match(b,!0))?(t.quote=0,t.fencedEndRE=new RegExp(d[1]+"+ *$"),t.localMode=x.fencedCodeBlockHighlighting&&function(e){if(q.findModeByName){var t=q.findModeByName(e);t&&(e=t.mime||t.mimes[0])}var r=q.getMode(p,e);return"null"==r.name?null:r}(d[2]),t.localMode&&(t.localState=q.startState(t.localMode)),t.f=t.block=A,x.highlightFormatting&&(t.formatting="code-block"),t.code=-1,D(t)):t.setext||!(c&&s||t.quote||!1!==t.list||t.code||h||k.test(e.string))&&(d=e.lookAhead(1))&&(d=d.match(y))?(t.setext?(t.header=t.setext,t.setext=0,e.skipToEnd(),x.highlightFormatting&&(t.formatting="header")):(t.header="="==d[0].charAt(0)?1:2,t.setext=t.header),t.thisLine.header=!0,t.f=t.inline,D(t)):h?(e.skipToEnd(),t.hr=!0,t.thisLine.hr=!0,_.hr):"["===e.peek()?L(e,t,E):L(e,t,t.inline)}function T(e,t){var r=w.token(e,t.htmlState);if(!i){var n=q.innerMode(w,t.htmlState);("xml"==n.mode.name&&null===n.state.tagStart&&!n.state.context&&n.state.tokenize.isInText||t.md_inside&&-1<e.current().indexOf(">"))&&(t.f=F,t.block=l,t.htmlState=null)}return r}function A(e,t){var r,n=t.listStack[t.listStack.length-1]||0,i=t.indentation<n,o=n+3;return t.fencedEndRE&&t.indentation<=o&&(i||e.match(t.fencedEndRE))?(x.highlightFormatting&&(t.formatting="code-block"),i||(r=D(t)),t.localMode=t.localState=null,t.block=l,t.f=F,t.fencedEndRE=null,t.code=0,t.thisLine.fencedCodeEnd=!0,i?M(e,t,t.block):r):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),_.code)}function D(e){var t=[];if(e.formatting){t.push(_.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(_.formatting+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(_.formatting+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&(!x.maxBlockquoteDepth||x.maxBlockquoteDepth>=e.quote?t.push(_.formatting+"-"+e.formatting[r]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(_.linkHref,"url"):(e.strong&&t.push(_.strong),e.em&&t.push(_.em),e.strikethrough&&t.push(_.strikethrough),e.emoji&&t.push(_.emoji),e.linkText&&t.push(_.linkText),e.code&&t.push(_.code),e.image&&t.push(_.image),e.imageAltText&&t.push(_.imageAltText,"link"),e.imageMarker&&t.push(_.imageMarker)),e.header&&t.push(_.header,_.header+"-"+e.header),e.quote&&(t.push(_.quote),!x.maxBlockquoteDepth||x.maxBlockquoteDepth>=e.quote?t.push(_.quote+"-"+e.quote):t.push(_.quote+"-"+x.maxBlockquoteDepth)),!1!==e.list){var n=(e.listStack.length-1)%3;n?1===n?t.push(_.list2):t.push(_.list3):t.push(_.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function t(e,t){if(e.match(r,!0))return D(t)}function F(e,t){var r=t.text(e,t);if(void 0!==r)return r;if(t.list)return t.list=null,D(t);if(t.taskList)return" "===e.match(C,!0)[1]?t.taskOpen=!0:t.taskClosed=!0,x.highlightFormatting&&(t.formatting="task"),t.taskList=!1,D(t);if(t.taskOpen=!1,t.taskClosed=!1,t.header&&e.match(/^#+$/,!0))return x.highlightFormatting&&(t.formatting="header"),D(t);var n=e.next();if(t.linkTitle){t.linkTitle=!1;var i=n;"("===n&&(i=")");var o="^\\s*(?:[^"+(i=(i+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+i;if(e.match(new RegExp(o),!0))return _.linkHref}if("`"===n){var l=t.formatting;x.highlightFormatting&&(t.formatting="code"),e.eatWhile("`");var s=e.current().length;if(0!=t.code||t.quote&&1!=s){if(s!=t.code)return t.formatting=l,D(t);var a=D(t);return t.code=0,a}return t.code=s,D(t)}if(t.code)return D(t);if("\\"===n&&(e.next(),x.highlightFormatting)){var u=D(t),c=_.formatting+"-escape";return u?u+" "+c:c}if("!"===n&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.imageMarker=!0,t.image=!0,x.highlightFormatting&&(t.formatting="image"),D(t);if("["===n&&t.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return t.imageMarker=!1,t.imageAltText=!0,x.highlightFormatting&&(t.formatting="image"),D(t);if("]"===n&&t.imageAltText){x.highlightFormatting&&(t.formatting="image");var u=D(t);return t.imageAltText=!1,t.image=!1,t.inline=t.f=N,u}if("["===n&&!t.image)return t.linkText&&e.match(/^.*?\]/)||(t.linkText=!0,x.highlightFormatting&&(t.formatting="link")),D(t);if("]"===n&&t.linkText){x.highlightFormatting&&(t.formatting="link");var u=D(t);return t.linkText=!1,t.inline=t.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?N:F,u}if("<"===n&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=O,x.highlightFormatting&&(t.formatting="link"),(u=D(t))?u+=" ":u="",u+_.linkInline;if("<"===n&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=O,x.highlightFormatting&&(t.formatting="link"),(u=D(t))?u+=" ":u="",u+_.linkEmail;if(x.xml&&"<"===n&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var h=e.string.indexOf(">",e.pos);if(-1!=h){var d=e.string.substring(e.start,h);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(d)&&(t.md_inside=!0)}return e.backUp(1),t.htmlState=q.startState(w),M(e,t,T)}if(x.xml&&"<"===n&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";if("*"===n||"_"===n){for(var f=1,p=1==e.pos?" ":e.string.charAt(e.pos-2);f<3&&e.eat(n);)f++;var g=e.peek()||" ",m=!/\s/.test(g)&&(!S.test(g)||/\s/.test(p)||S.test(p)),v=!/\s/.test(p)&&(!S.test(p)||/\s/.test(g)||S.test(g)),y=null,b=null;if(f%2&&(t.em||!m||"*"!==n&&v&&!S.test(p)?t.em!=n||!v||"*"!==n&&m&&!S.test(g)||(y=!1):y=!0),1<f&&(t.strong||!m||"*"!==n&&v&&!S.test(p)?t.strong!=n||!v||"*"!==n&&m&&!S.test(g)||(b=!1):b=!0),null!=b||null!=y){x.highlightFormatting&&(t.formatting=null==y?"strong":null==b?"em":"strong em"),!0===y&&(t.em=n),!0===b&&(t.strong=n);a=D(t);return!1===y&&(t.em=!1),!1===b&&(t.strong=!1),a}}else if(" "===n&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return D(t);e.backUp(1)}if(x.strikethrough)if("~"===n&&e.eatWhile(n)){if(t.strikethrough){x.highlightFormatting&&(t.formatting="strikethrough");a=D(t);return t.strikethrough=!1,a}if(e.match(/^[^\s]/,!1))return t.strikethrough=!0,x.highlightFormatting&&(t.formatting="strikethrough"),D(t)}else if(" "===n&&e.match(/^~~/,!0)){if(" "===e.peek())return D(t);e.backUp(2)}if(x.emoji&&":"===n&&e.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){t.emoji=!0,x.highlightFormatting&&(t.formatting="emoji");var k=D(t);return t.emoji=!1,k}return" "===n&&(e.match(/^ +$/,!1)?t.trailingSpace++:t.trailingSpace&&(t.trailingSpaceNewLine=!0)),D(t)}function O(e,t){if(">"!==e.next())return e.match(/^[^>]+/,!0),_.linkInline;t.f=t.inline=F,x.highlightFormatting&&(t.formatting="link");var r=D(t);return r?r+=" ":r="",r+_.linkInline}function N(e,t){if(e.eatSpace())return null;var i,r=e.next();return"("===r||"["===r?(t.f=t.inline=(i="("===r?")":"]",function(e,t){var r=e.next();if(r!==i)return e.match(o[i]),t.linkHref=!0,D(t);t.f=t.inline=F,x.highlightFormatting&&(t.formatting="link-string");var n=D(t);return t.linkHref=!1,n}),x.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,D(t)):"error"}var o={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=s,e.next(),x.highlightFormatting&&(t.formatting="link"),t.linkText=!0,D(t)):L(e,t,F)}function s(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=a,x.highlightFormatting&&(t.formatting="link");var r=D(t);return t.linkText=!1,r}return e.match(/^([^\]\\]|\\.)+/,!0),_.linkText}function a(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=F,_.linkHref+" url")}var u={startState:function(){return{f:l,prevLine:{stream:null},thisLine:{stream:null},block:l,htmlState:null,indentation:0,inline:F,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&&q.copyState(w,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?q.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 n(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!=T)){var r=e.match(/^\s*/,!0)[0].replace(/\t/g,"    ").length;if(t.indentation=r,t.indentationDiff=null,0<r)return null}}return t.f(e,t)},innerMode:function(e){return e.block==T?{state:e.htmlState,mode:w}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:u}},indent:function(e,t,r){return e.block==T&&w.indent?w.indent(e.htmlState,t,r):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,t,r):q.Pass},blankLine:n,getType:D,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return u},"xml"),q.defineMIME("text/markdown","markdown"),q.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){"use strict";t.overlayMode=function(n,i,o){return{startState:function(){return{base:t.startState(n),overlay:t.startState(i),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(e){return{base:t.copyState(n,e.base),overlay:t.copyState(i,e.overlay),basePos:e.basePos,baseCur:null,overlayPos:e.overlayPos,overlayCur:null}},token:function(e,t){return(e!=t.streamSeen||Math.min(t.basePos,t.overlayPos)<e.start)&&(t.streamSeen=e,t.basePos=t.overlayPos=e.start),e.start==t.basePos&&(t.baseCur=n.token(e,t.base),t.basePos=e.pos),e.start==t.overlayPos&&(e.pos=e.start,t.overlayCur=i.token(e,t.overlay),t.overlayPos=e.pos),e.pos=Math.min(t.basePos,t.overlayPos),null==t.overlayCur?t.baseCur:null!=t.baseCur&&t.overlay.combineTokens||o&&null==t.overlay.combineTokens?t.baseCur+" "+t.overlayCur:t.overlayCur},indent:n.indent&&function(e,t,r){return n.indent(e.base,t,r)},electricChars:n.electricChars,innerMode:function(e){return{state:e.base,mode:n}},blankLine:function(e){var t,r;return n.blankLine&&(t=n.blankLine(e.base)),i.blankLine&&(r=i.blankLine(e.overlay)),null==r?t:o&&null!=t?t+" "+r:r}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(Ge){"use strict";Ge.defineMode("javascript",function(e,h){var n,i,d=e.indentUnit,f=h.statementIndent,l=h.jsonld,s=h.json||l,u=h.typescript,c=h.wordCharacters||/[\w$\xa1-\uffff]/,a=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("keyword d"),o=e("operator"),l={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:i,break:i,continue:i,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:l,false:l,null:l,undefined:l,NaN:l,Infinity:l,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),p=/[+\-*&%=<>!?|~^@]/,g=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function m(e,t,r){return n=e,i=r,t}function v(e,t){var i,r=e.next();if('"'==r||"'"==r)return t.tokenize=(i=r,function(e,t){var r,n=!1;if(l&&"@"==e.peek()&&e.match(g))return t.tokenize=v,m("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=i||n);)n=!n&&"\\"==r;return n||(t.tokenize=v),m("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return m("number","number");if("."==r&&e.match(".."))return m("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return m(r);if("="==r&&e.eat(">"))return m("=>","operator");if("0"==r&&e.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return m("number","number");if(/\d/.test(r))return e.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),m("number","number");if("/"==r)return e.eat("*")?(t.tokenize=y)(e,t):e.eat("/")?(e.skipToEnd(),m("comment","comment")):Ve(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),m("regexp","string-2")):(e.eat("="),m("operator","operator",e.current()));if("`"==r)return(t.tokenize=b)(e,t);if("#"==r)return e.skipToEnd(),m("error","error");if(p.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),m("operator","operator",e.current());if(c.test(r)){e.eatWhile(c);var n=e.current();if("."!=t.lastType){if(a.propertyIsEnumerable(n)){var o=a[n];return m(o.type,o.style,n)}if("async"==n&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return m("async","keyword",n)}return m("variable","variable",n)}}function y(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=v;break}n="*"==r}return m("comment","comment")}function b(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=v;break}n=!n&&"\\"==r}return m("quasi","string-2",e.current())}var k="([{}])";function o(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(u){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var i=0,o=!1,l=r-1;0<=l;--l){var s=e.string.charAt(l),a=k.indexOf(s);if(0<=a&&a<3){if(!i){++l;break}if(0==--i){"("==s&&(o=!0);break}}else if(3<=a&&a<6)++i;else if(c.test(s))o=!0;else{if(/["'\/]/.test(s))return;if(o&&!i){++l;break}}}o&&!i&&(t.fatArrowAt=l)}}var x={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function w(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function _(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var C={state:null,column:null,marked:null,cc:null};function S(){for(var e=arguments.length-1;0<=e;e--)C.cc.push(arguments[e])}function L(){return S.apply(null,arguments),!0}function M(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function r(e){var t=C.state;if(C.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,r){{if(r){if(r.block){var n=e(t,r.prev);return n?n==r.prev?r:new A(n,r.vars,!0):null}return M(t,r.vars)?r:new A(r.prev,new D(t,r.vars),!1)}return null}}(e,t.context);if(null!=r)return void(t.context=r)}else if(!M(e,t.localVars))return void(t.localVars=new D(e,t.localVars));h.globalVars&&!M(e,t.globalVars)&&(t.globalVars=new D(e,t.globalVars))}function T(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function A(e,t,r){this.prev=e,this.vars=t,this.block=r}function D(e,t){this.name=e,this.next=t}var t=new D("this",new D("arguments",null));function F(){C.state.context=new A(C.state.context,C.state.localVars,!1),C.state.localVars=t}function O(){C.state.context=new A(C.state.context,C.state.localVars,!0),C.state.localVars=null}function N(){C.state.localVars=C.state.context.vars,C.state.context=C.state.context.prev}function E(n,i){var e=function(){var e=C.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var r=e.lexical;r&&")"==r.type&&r.align;r=r.prev)t=r.indented;e.lexical=new w(t,C.stream.column(),n,null,e.lexical,i)};return e.lex=!0,e}function q(){var e=C.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function z(r){return function e(t){return t==r?L():";"==r||"}"==t||")"==t||"]"==t?S():L(e)}}function W(e,t){return"var"==e?L(E("vardef",t),ve,z(";"),q):"keyword a"==e?L(E("form"),R,W,q):"keyword b"==e?L(E("form"),W,q):"keyword d"==e?C.stream.match(/^\s*$/,!1)?L():L(E("stat"),$,z(";"),q):"debugger"==e?L(z(";")):"{"==e?L(E("}"),O,oe,q,N):";"==e?L():"if"==e?("else"==C.state.lexical.info&&C.state.cc[C.state.cc.length-1]==q&&C.state.cc.pop()(),L(E("form"),R,W,q,_e)):"function"==e?L(Me):"for"==e?L(E("form"),Ce,W,q):"class"==e||u&&"interface"==t?(C.marked="keyword",L(E("form","class"==e?e:t),Oe,q)):"variable"==e?u&&"declare"==t?(C.marked="keyword",L(W)):u&&("module"==t||"enum"==t||"type"==t)&&C.stream.match(/^\s*\w/,!1)?(C.marked="keyword","enum"==t?L(je):"type"==t?L(Ae,z("operator"),ue,z(";")):L(E("form"),ye,z("{"),E("}"),oe,q,q)):u&&"namespace"==t?(C.marked="keyword",L(E("form"),H,W,q)):u&&"abstract"==t?(C.marked="keyword",L(W)):L(E("stat"),Q):"switch"==e?L(E("form"),R,z("{"),E("}","switch"),O,oe,q,q,N):"case"==e?L(H,z(":")):"default"==e?L(z(":")):"catch"==e?L(E("form"),F,P,W,q,N):"export"==e?L(E("stat"),ze,q):"import"==e?L(E("stat"),Pe,q):"async"==e?L(W):"@"==t?L(H,W):S(E("stat"),H,z(";"),q)}function P(e){if("("==e)return L(De,z(")"))}function H(e,t){return B(e,t,!1)}function I(e,t){return B(e,t,!0)}function R(e){return"("!=e?S():L(E(")"),H,z(")"),q)}function B(e,t,r){if(C.state.fatArrowAt==C.stream.start){var n=r?Z:K;if("("==e)return L(F,E(")"),ne(De,")"),q,z("=>"),n,N);if("variable"==e)return S(F,ye,z("=>"),n,N)}var i,o=r?U:j;return x.hasOwnProperty(e)?L(o):"function"==e?L(Me,o):"class"==e||u&&"interface"==t?(C.marked="keyword",L(E("form"),Fe,q)):"keyword c"==e||"async"==e?L(r?I:H):"("==e?L(E(")"),$,z(")"),q,o):"operator"==e||"spread"==e?L(r?I:H):"["==e?L(E("]"),$e,q,o):"{"==e?ie(ee,"}",null,o):"quasi"==e?S(V,o):"new"==e?L((i=r,function(e){return"."==e?L(i?Y:X):"variable"==e&&u?L(pe,i?U:j):S(i?I:H)})):"import"==e?L(H):L()}function $(e){return e.match(/[;\}\)\],]/)?S():S(H)}function j(e,t){return","==e?L(H):U(e,t,!1)}function U(e,t,r){var n=0==r?j:U,i=0==r?H:I;return"=>"==e?L(F,r?Z:K,N):"operator"==e?/\+\+|--/.test(t)||u&&"!"==t?L(n):u&&"<"==t&&C.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?L(E(">"),ne(ue,">"),q,n):"?"==t?L(H,z(":"),i):L(i):"quasi"==e?S(V,n):";"!=e?"("==e?ie(I,")","call",n):"."==e?L(J,n):"["==e?L(E("]"),$,z("]"),q,n):u&&"as"==t?(C.marked="keyword",L(ue,n)):"regexp"==e?(C.state.lastType=C.marked="operator",C.stream.backUp(C.stream.pos-C.stream.start-1),L(i)):void 0:void 0}function V(e,t){return"quasi"!=e?S():"${"!=t.slice(t.length-2)?L(V):L(H,G)}function G(e){if("}"==e)return C.marked="string-2",C.state.tokenize=b,L(V)}function K(e){return o(C.stream,C.state),S("{"==e?W:H)}function Z(e){return o(C.stream,C.state),S("{"==e?W:I)}function X(e,t){if("target"==t)return C.marked="keyword",L(j)}function Y(e,t){if("target"==t)return C.marked="keyword",L(U)}function Q(e){return":"==e?L(q,W):S(j,z(";"),q)}function J(e){if("variable"==e)return C.marked="property",L()}function ee(e,t){if("async"==e)return C.marked="property",L(ee);if("variable"==e||"keyword"==C.style){return C.marked="property","get"==t||"set"==t?L(te):(u&&C.state.fatArrowAt==C.stream.start&&(r=C.stream.match(/^\s*:\s*/,!1))&&(C.state.fatArrowAt=C.stream.pos+r[0].length),L(re));var r}else{if("number"==e||"string"==e)return C.marked=l?"property":C.style+" property",L(re);if("jsonld-keyword"==e)return L(re);if(u&&T(t))return C.marked="keyword",L(ee);if("["==e)return L(H,le,z("]"),re);if("spread"==e)return L(I,re);if("*"==t)return C.marked="keyword",L(ee);if(":"==e)return S(re)}}function te(e){return"variable"!=e?S(re):(C.marked="property",L(Me))}function re(e){return":"==e?L(I):"("==e?S(Me):void 0}function ne(n,i,o){function l(e,t){if(o?-1<o.indexOf(e):","==e){var r=C.state.lexical;return"call"==r.info&&(r.pos=(r.pos||0)+1),L(function(e,t){return e==i||t==i?S():S(n)},l)}return e==i||t==i?L():o&&-1<o.indexOf(";")?S(n):L(z(i))}return function(e,t){return e==i||t==i?L():S(n,l)}}function ie(e,t,r){for(var n=3;n<arguments.length;n++)C.cc.push(arguments[n]);return L(E(t,r),ne(e,t),q)}function oe(e){return"}"==e?L():S(W,oe)}function le(e,t){if(u){if(":"==e||"in"==t)return L(ue);if("?"==t)return L(le)}}function se(e){if(u&&":"==e)return C.stream.match(/^\s*\w+\s+is\b/,!1)?L(H,ae,ue):L(ue)}function ae(e,t){if("is"==t)return C.marked="keyword",L()}function ue(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(C.marked="keyword",L("typeof"==t?I:ue)):"variable"==e||"void"==t?(C.marked="type",L(fe)):"|"==t||"&"==t?L(ue):"string"==e||"number"==e||"atom"==e?L(fe):"["==e?L(E("]"),ne(ue,"]",","),q,fe):"{"==e?L(E("}"),ne(he,"}",",;"),q,fe):"("==e?L(ne(de,")"),ce,fe):"<"==e?L(ne(ue,">"),ue):void 0}function ce(e){if("=>"==e)return L(ue)}function he(e,t){return"variable"==e||"keyword"==C.style?(C.marked="property",L(he)):"?"==t||"number"==e||"string"==e?L(he):":"==e?L(ue):"["==e?L(z("variable"),le,z("]"),he):"("==e?S(Te,he):void 0}function de(e,t){return"variable"==e&&C.stream.match(/^\s*[?:]/,!1)||"?"==t?L(de):":"==e?L(ue):"spread"==e?L(de):S(ue)}function fe(e,t){return"<"==t?L(E(">"),ne(ue,">"),q,fe):"|"==t||"."==e||"&"==t?L(ue):"["==e?L(ue,z("]"),fe):"extends"==t||"implements"==t?(C.marked="keyword",L(ue)):"?"==t?L(ue,z(":"),ue):void 0}function pe(e,t){if("<"==t)return L(E(">"),ne(ue,">"),q,fe)}function ge(){return S(ue,me)}function me(e,t){if("="==t)return L(ue)}function ve(e,t){return"enum"==t?(C.marked="keyword",L(je)):S(ye,le,xe,we)}function ye(e,t){return u&&T(t)?(C.marked="keyword",L(ye)):"variable"==e?(r(t),L()):"spread"==e?L(ye):"["==e?ie(ke,"]"):"{"==e?ie(be,"}"):void 0}function be(e,t){return"variable"!=e||C.stream.match(/^\s*:/,!1)?("variable"==e&&(C.marked="property"),"spread"==e?L(ye):"}"==e?S():"["==e?L(H,z("]"),z(":"),be):L(z(":"),ye,xe)):(r(t),L(xe))}function ke(){return S(ye,xe)}function xe(e,t){if("="==t)return L(I)}function we(e){if(","==e)return L(ve)}function _e(e,t){if("keyword b"==e&&"else"==t)return L(E("form","else"),W,q)}function Ce(e,t){return"await"==t?L(Ce):"("==e?L(E(")"),Se,q):void 0}function Se(e){return"var"==e?L(ve,Le):"variable"==e?L(Le):S(Le)}function Le(e,t){return")"==e?L():";"==e?L(Le):"in"==t||"of"==t?(C.marked="keyword",L(H,Le)):S(H,Le)}function Me(e,t){return"*"==t?(C.marked="keyword",L(Me)):"variable"==e?(r(t),L(Me)):"("==e?L(F,E(")"),ne(De,")"),q,se,W,N):u&&"<"==t?L(E(">"),ne(ge,">"),q,Me):void 0}function Te(e,t){return"*"==t?(C.marked="keyword",L(Te)):"variable"==e?(r(t),L(Te)):"("==e?L(F,E(")"),ne(De,")"),q,se,N):u&&"<"==t?L(E(">"),ne(ge,">"),q,Te):void 0}function Ae(e,t){return"keyword"==e||"variable"==e?(C.marked="type",L(Ae)):"<"==t?L(E(">"),ne(ge,">"),q):void 0}function De(e,t){return"@"==t&&L(H,De),"spread"==e?L(De):u&&T(t)?(C.marked="keyword",L(De)):u&&"this"==e?L(le,xe):S(ye,le,xe)}function Fe(e,t){return"variable"==e?Oe(e,t):Ne(e,t)}function Oe(e,t){if("variable"==e)return r(t),L(Ne)}function Ne(e,t){return"<"==t?L(E(">"),ne(ge,">"),q,Ne):"extends"==t||"implements"==t||u&&","==e?("implements"==t&&(C.marked="keyword"),L(u?ue:H,Ne)):"{"==e?L(E("}"),Ee,q):void 0}function Ee(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||u&&T(t))&&C.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(C.marked="keyword",L(Ee)):"variable"==e||"keyword"==C.style?(C.marked="property",L(u?qe:Me,Ee)):"number"==e||"string"==e?L(u?qe:Me,Ee):"["==e?L(H,le,z("]"),u?qe:Me,Ee):"*"==t?(C.marked="keyword",L(Ee)):u&&"("==e?S(Te,Ee):";"==e||","==e?L(Ee):"}"==e?L():"@"==t?L(H,Ee):void 0}function qe(e,t){if("?"==t)return L(qe);if(":"==e)return L(ue,xe);if("="==t)return L(I);var r=C.state.lexical.prev;return S(r&&"interface"==r.info?Te:Me)}function ze(e,t){return"*"==t?(C.marked="keyword",L(Be,z(";"))):"default"==t?(C.marked="keyword",L(H,z(";"))):"{"==e?L(ne(We,"}"),Be,z(";")):S(W)}function We(e,t){return"as"==t?(C.marked="keyword",L(z("variable"))):"variable"==e?S(I,We):void 0}function Pe(e){return"string"==e?L():"("==e?S(H):S(He,Ie,Be)}function He(e,t){return"{"==e?ie(He,"}"):("variable"==e&&r(t),"*"==t&&(C.marked="keyword"),L(Re))}function Ie(e){if(","==e)return L(He,Ie)}function Re(e,t){if("as"==t)return C.marked="keyword",L(He)}function Be(e,t){if("from"==t)return C.marked="keyword",L(H)}function $e(e){return"]"==e?L():S(ne(I,"]"))}function je(){return S(E("form"),ye,z("{"),E("}"),ne(Ue,"}"),q,q)}function Ue(){return S(ye,xe)}function Ve(e,t,r){return t.tokenize==v&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return q.lex=N.lex=!0,{startState:function(e){var t={tokenize:v,lastType:"sof",cc:[],lexical:new w((e||0)-d,0,"block",!1),localVars:h.localVars,context:h.localVars&&new A(null,null,!1),indented:e||0};return h.globalVars&&"object"==typeof h.globalVars&&(t.globalVars=h.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),o(e,t)),t.tokenize!=y&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==n?r:(t.lastType="operator"!=n||"++"!=i&&"--"!=i?n:"incdec",function(e,t,r,n,i){var o=e.cc;for(C.state=e,C.stream=i,C.marked=null,C.cc=o,C.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():s?H:W)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return C.marked?C.marked:"variable"==r&&_(e,n)?"variable-2":t}}(t,r,n,i,e))},indent:function(e,t){if(e.tokenize==y)return Ge.Pass;if(e.tokenize!=v)return 0;var r,n=t&&t.charAt(0),i=e.lexical;if(!/^\s*else\b/.test(t))for(var o=e.cc.length-1;0<=o;--o){var l=e.cc[o];if(l==q)i=i.prev;else if(l!=_e)break}for(;("stat"==i.type||"form"==i.type)&&("}"==n||(r=e.cc[e.cc.length-1])&&(r==j||r==U)&&!/^[,\.=+\-*:?[\(]/.test(t));)i=i.prev;f&&")"==i.type&&"stat"==i.prev.type&&(i=i.prev);var s,a,u=i.type,c=n==u;return"vardef"==u?i.indented+("operator"==e.lastType||","==e.lastType?i.info.length+1:0):"form"==u&&"{"==n?i.indented:"form"==u?i.indented+d:"stat"==u?i.indented+(a=t,"operator"==(s=e).lastType||","==s.lastType||p.test(a.charAt(0))||/[,.]/.test(a.charAt(0))?f||d:0):"switch"!=i.info||c||0==h.doubleIndentSwitch?i.align?i.column+(c?0:1):i.indented+(c?0:d):i.indented+(/^(?:case|default)\b/.test(t)?d:2*d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:Ve,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=H&&t!=I||e.cc.pop()}}}),Ge.registerHelper("wordChars","javascript",/[\w$]/),Ge.defineMIME("text/javascript","javascript"),Ge.defineMIME("text/ecmascript","javascript"),Ge.defineMIME("application/javascript","javascript"),Ge.defineMIME("application/x-javascript","javascript"),Ge.defineMIME("application/ecmascript","javascript"),Ge.defineMIME("application/json",{name:"javascript",json:!0}),Ge.defineMIME("application/x-json",{name:"javascript",json:!0}),Ge.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),Ge.defineMIME("text/typescript",{name:"javascript",typescript:!0}),Ge.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(u){"use strict";function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function s(i,o,l){return 0==i.length?a(o):function(e,t){for(var r=i[0],n=0;n<r.length;n++)if(e.match(r[n][0]))return t.tokenize=s(i.slice(1),o),r[n][1];return t.tokenize=a(o,l),"string"}}function a(r,n){return function(e,t){return function(e,t,r,n){if(!1!==n&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==n&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=s([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],r,n)),e.match(/\-\>\w/,!1)&&(t.tokenize=s([[["->",null]],[[/[\w]+/,"variable"]]],r,n)),"variable-2";var i=!1;for(;!e.eol()&&(i||!1===n||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(r)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}(e,t,r,n)}}var t="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",r="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",n="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";u.registerHelper("hintWords","php",[t,r,n].join(" ").split(" ")),u.registerHelper("wordChars","php",/[\w$]/);var i={name:"clike",helperType:"php",keywords:e(t),blockKeywords:e("catch do else elseif for foreach if switch try while finally"),defKeywords:e("class function interface namespace trait"),atoms:e(r),builtin:e(n),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var n=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var i=e.current().slice(r[0].length+(n?2:1));if(n&&e.eat(n),i)return(t.tokStack||(t.tokStack=[])).push(i,0),t.tokenize=a(i,"'"!=n),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=a('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&0<t.tokStack.length&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=a(t.tokStack[t.tokStack.length-2])),!1}}};u.defineMode("php",function(e,r){var s=u.getMode(e,r&&r.htmlMode||"text/html"),a=u.getMode(e,i);return{startState:function(){var e=u.startState(s),t=r.startOpen?u.startState(a):null;return{html:e,php:t,curMode:r.startOpen?a:s,curState:r.startOpen?t:e,pending:null}},copyState:function(e){var t,r=e.html,n=u.copyState(s,r),i=e.php,o=i&&u.copyState(a,i);return t=e.curMode==s?n:o,{html:n,php:o,curMode:e.curMode,curState:t,pending:e.pending}},token:function(e,t){var r=t.curMode==a;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),r)return r&&null==t.php.tokenize&&e.match("?>")?(t.curMode=s,t.curState=t.html,t.php.context.prev||(t.php=null),"meta"):a.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=a,t.php||(t.php=u.startState(a,s.indent(t.html,"",""))),t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var n="string"}else n=t.pending&&e.pos<t.pending.end?(e.pos=t.pending.end,t.pending.style):s.token(e,t.curState);t.pending&&(t.pending=null);var i,o=e.current(),l=o.search(/<\?/);return-1!=l&&("string"==n&&(i=o.match(/[\'\"]$/))&&!/\?>/.test(o)?t.pending=i[0]:t.pending={end:e.pos,style:n},e.backUp(o.length-l)),n},indent:function(e,t,r){return e.curMode!=a&&/^\s*<\//.test(t)||e.curMode==a&&/^\?>/.test(t)?s.indent(e.html,t,r):e.curMode.indent(e.curState,t,r)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),u.defineMIME("application/x-httpd-php","php"),u.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),u.defineMIME("text/x-php",i)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(l){"use strict";var s=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;l.defineMode("gfm",function(e,i){var o=0;var t={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,t){if(t.combineTokens=null,t.codeBlock)return e.match(/^```+/)?t.codeBlock=!1:e.skipToEnd(),null;if(e.sol()&&(t.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),t.codeBlock=!0,null;if("`"===e.peek()){e.next();var r=e.pos;e.eatWhile("`");var n=1+e.pos-r;return t.code?n===o&&(t.code=!1):(o=n,t.code=!0),null}if(t.code)return e.next(),null;if(e.eatSpace())return t.ateSpace=!0,null;if((e.sol()||t.ateSpace)&&(t.ateSpace=!1)!==i.gitHubSpice){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return t.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return t.combineTokens=!0,"link"}return e.match(s)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(t.combineTokens=!0,"link"):(e.next(),null)},blankLine:function(e){return e.code=!1,null}},r={taskLists:!0,strikethrough:!0,emoji:!0};for(var n in i)r[n]=i[n];return r.name="markdown",l.overlayMode(l.getMode(e,r),t)},"markdown"),l.defineMIME("text/x-gfm","gfm")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(_){"use strict";var C={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},S={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};_.defineMode("xml",function(e,t){var l,o,s=e.indentUnit,a={},r=t.htmlMode?C:S;for(var n in r)a[n]=r[n];for(var n in t)a[n]=t[n];function u(t,r){function e(e){return(r.tokenize=e)(t,r)}var n=t.next();return"<"==n?t.eat("!")?t.eat("[")?t.match("CDATA[")?e(i("atom","]]>")):null:t.match("--")?e(i("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),e(function n(i){return function(e,t){for(var r;null!=(r=e.next());){if("<"==r)return t.tokenize=n(i+1),t.tokenize(e,t);if(">"==r){if(1!=i)return t.tokenize=n(i-1),t.tokenize(e,t);t.tokenize=u;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),r.tokenize=i("meta","?>"),"meta"):(l=t.eat("/")?"closeTag":"openTag",r.tokenize=c,"tag bracket"):"&"!=n?(t.eatWhile(/[^&<]/),null):(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error"}function c(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=u,l=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return l="equals",null;if("<"!=r)return/[\'\"]/.test(r)?(t.tokenize=(n=r,(i=function(e,t){for(;!e.eol();)if(e.next()==n){t.tokenize=c;break}return"string"}).isInAttribute=!0,i),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");t.tokenize=u,t.state=p,t.tagName=t.tagStart=null;var n,i,o=t.tokenize(e,t);return o?o+" tag error":"tag error"}function i(r,n){return function(e,t){for(;!e.eol();){if(e.match(n)){t.tokenize=u;break}e.next()}return r}}function h(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(a.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function d(e){e.context&&(e.context=e.context.prev)}function f(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!a.contextGrabbers.hasOwnProperty(r)||!a.contextGrabbers[r].hasOwnProperty(t))return;d(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),g):"closeTag"==e?m:p}function g(e,t,r){return"word"==e?(r.tagName=t.current(),o="tag",b):a.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,t,r)):(o="error",g)}function m(e,t,r){if("word"!=e)return a.allowMissingTagName&&"endTag"==e?(o="tag bracket",v(e,t,r)):(o="error",y);var n=t.current();return r.context&&r.context.tagName!=n&&a.implicitlyClosed.hasOwnProperty(r.context.tagName)&&d(r),r.context&&r.context.tagName==n||!1===a.matchClosing?(o="tag",v):(o="tag error",y)}function v(e,t,r){return"endTag"!=e?(o="error",v):(d(r),p)}function y(e,t,r){return o="error",v(e,0,r)}function b(e,t,r){if("word"==e)return o="attribute",k;if("endTag"!=e&&"selfcloseTag"!=e)return o="error",b;var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||a.autoSelfClosers.hasOwnProperty(n)?f(r,n):(f(r,n),r.context=new h(r,n,i==r.indented)),p}function k(e,t,r){return"equals"==e?x:(a.allowMissing||(o="error"),b(e,0,r))}function x(e,t,r){return"string"==e?w:"word"==e&&a.allowUnquoted?(o="string",b):(o="error",b(e,0,r))}function w(e,t,r){return"string"==e?w:b(e,0,r)}return u.isInText=!0,{startState:function(e){var t={tokenize:u,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;l=null;var r=t.tokenize(e,t);return(r||l)&&"comment"!=r&&(o=null,t.state=t.state(l||r,e,t),o&&(r="error"==o?r+" error":o)),r},indent:function(e,t,r){var n=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+s;if(n&&n.noIndent)return _.Pass;if(e.tokenize!=c&&e.tokenize!=u)return r?r.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==a.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+s*(a.multilineTagIndentFactor||1);if(a.alignCDATA&&/<!\[CDATA\[/.test(t))return 0;var i=t&&/^<(\/)?([\w_:\.-]*)/.exec(t);if(i&&i[1])for(;n;){if(n.tagName==i[2]){n=n.prev;break}if(!a.implicitlyClosed.hasOwnProperty(n.tagName))break;n=n.prev}else if(i)for(;n;){var o=a.contextGrabbers[n.tagName];if(!o||!o.hasOwnProperty(i[2]))break;n=n.prev}for(;n&&n.prev&&!n.startOfLine;)n=n.prev;return n?n.indent+s:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:a.htmlMode?"html":"xml",helperType:a.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=b)}}}),_.defineMIME("text/xml","xml"),_.defineMIME("application/xml","xml"),_.mimeModes.hasOwnProperty("text/html")||_.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"use strict";var y={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:p,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:p,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:p,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||v.defaults,this.rules=y.normal,this.options.pedantic?this.rules=y.pedantic:this.options.gfm&&(this.options.tables?this.rules=y.tables:this.rules=y.gfm)}y._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,y._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,y.def=o(y.def).replace("label",y._label).replace("title",y._title).getRegex(),y.bullet=/(?:[*+-]|\d{1,9}\.)/,y.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,y.item=o(y.item,"gm").replace(/bull/g,y.bullet).getRegex(),y.list=o(y.list).replace(/bull/g,y.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+y.def.source+")").getRegex(),y._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",y._comment=/<!--(?!-?>)[\s\S]*?-->/,y.html=o(y.html,"i").replace("comment",y._comment).replace("tag",y._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),y.paragraph=o(y.paragraph).replace("hr",y.hr).replace("heading",y.heading).replace("lheading",y.lheading).replace("tag",y._tag).getRegex(),y.blockquote=o(y.blockquote).replace("paragraph",y.paragraph).getRegex(),y.normal=g({},y),y.gfm=g({},y.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),y.gfm.paragraph=o(y.paragraph).replace("(?!","(?!"+y.gfm.fences.source.replace("\\1","\\2")+"|"+y.list.source.replace("\\1","\\3")+"|").getRegex(),y.tables=g({},y.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),y.pedantic=g({},y.normal,{html:o("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",y._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=y,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var r,n,i,o,l,s,a,u,c,h,d,f,p,g,m,v;for(e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),1<i[0].length&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:k(i,"\n")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2]?i[2].trim():i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(t&&(i=this.rules.nptable.exec(e))&&(s={type:"table",header:b(i[1].replace(/^ *| *\| *$/g,"")),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/\n$/,"").split("\n"):[]}).header.length===s.align.length){for(e=e.substring(i[0].length),d=0;d<s.align.length;d++)/^ *-+: *$/.test(s.align[d])?s.align[d]="right":/^ *:-+: *$/.test(s.align[d])?s.align[d]="center":/^ *:-+ *$/.test(s.align[d])?s.align[d]="left":s.align[d]=null;for(d=0;d<s.cells.length;d++)s.cells[d]=b(s.cells[d],s.header.length);this.tokens.push(s)}else if(i=this.rules.hr.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"hr"});else if(i=this.rules.blockquote.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"blockquote_start"}),i=i[0].replace(/^ *> ?/gm,""),this.token(i,t),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),a={type:"list_start",ordered:g=1<(o=i[2]).length,start:g?+o:"",loose:!1},this.tokens.push(a),r=!(u=[]),p=(i=i[0].match(this.rules.item)).length,d=0;d<p;d++)h=(s=i[d]).length,~(s=s.replace(/^ *([*+-]|\d+\.) */,"")).indexOf("\n ")&&(h-=s.length,s=this.options.pedantic?s.replace(/^ {1,4}/gm,""):s.replace(new RegExp("^ {1,"+h+"}","gm"),"")),d!==p-1&&(l=y.bullet.exec(i[d+1])[0],(1<o.length?1===l.length:1<l.length||this.options.smartLists&&l!==o)&&(e=i.slice(d+1).join("\n")+e,d=p-1)),n=r||/\n\n(?!\s*$)/.test(s),d!==p-1&&(r="\n"===s.charAt(s.length-1),n||(n=r)),n&&(a.loose=!0),v=void 0,(m=/^\[[ xX]\] /.test(s))&&(v=" "!==s[1],s=s.replace(/^\[[ xX]\] +/,"")),c={type:"list_item_start",task:m,checked:v,loose:n},u.push(c),this.tokens.push(c),this.token(s,!1),this.tokens.push({type:"list_item_end"});if(a.loose)for(p=u.length,d=0;d<p;d++)u[d].loose=!0;this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(t&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),i[3]&&(i[3]=i[3].substring(1,i[3].length-1)),f=i[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[f]||(this.tokens.links[f]={href:i[2],title:i[3]});else if(t&&(i=this.rules.table.exec(e))&&(s={type:"table",header:b(i[1].replace(/^ *| *\| *$/g,"")),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/(?: *\| *)?\n$/,"").split("\n"):[]}).header.length===s.align.length){for(e=e.substring(i[0].length),d=0;d<s.align.length;d++)/^ *-+: *$/.test(s.align[d])?s.align[d]="right":/^ *:-+: *$/.test(s.align[d])?s.align[d]="center":/^ *:-+ *$/.test(s.align[d])?s.align[d]="left":s.align[d]=null;for(d=0;d<s.cells.length;d++)s.cells[d]=b(s.cells[d].replace(/^ *\| *| *\| *$/g,""),s.header.length);this.tokens.push(s)}else if(i=this.rules.lheading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:"="===i[2]?1:2,text:i[1]});else if(t&&(i=this.rules.paragraph.exec(e)))e=e.substring(i[0].length),this.tokens.push({type:"paragraph",text:"\n"===i[1].charAt(i[1].length-1)?i[1].slice(0,-1):i[1]});else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"text",text:i[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var r={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:p,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:p,text:/^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/};function c(e,t){if(this.options=t||v.defaults,this.links=e,this.rules=r.normal,this.renderer=this.options.renderer||new n,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.pedantic?this.rules=r.pedantic:this.options.gfm&&(this.options.breaks?this.rules=r.breaks:this.rules=r.gfm)}function n(e){this.options=e||v.defaults}function i(){}function u(e){this.tokens=[],this.token=null,this.options=e||v.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer,this.renderer.options=this.options,this.slugger=new t}function t(){this.seen={}}function h(e,t){if(t){if(h.escapeTest.test(e))return e.replace(h.escapeReplace,function(e){return h.replacements[e]})}else if(h.escapeTestNoEncode.test(e))return e.replace(h.escapeReplaceNoEncode,function(e){return h.replacements[e]});return e}function d(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function o(r,e){return r=r.source||r,e=e||"",{replace:function(e,t){return t=(t=t.source||t).replace(/(^|[^\[])\^/g,"$1"),r=r.replace(e,t),this},getRegex:function(){return new RegExp(r,e)}}}function l(e,t,r){if(e){try{var n=decodeURIComponent(d(r)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}t&&!f.test(r)&&(r=function(e,t){s[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?s[" "+e]=e+"/":s[" "+e]=k(e,"/",!0));return e=s[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}(t,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r}r._punctuation="!\"#$%&'()*+,\\-./:;<=>?@\\[^_{|}~",r.em=o(r.em).replace(/punctuation/g,r._punctuation).getRegex(),r._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,r._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,r._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,r.autolink=o(r.autolink).replace("scheme",r._scheme).replace("email",r._email).getRegex(),r._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,r.tag=o(r.tag).replace("comment",y._comment).replace("attribute",r._attribute).getRegex(),r._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,r._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/,r._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,r.link=o(r.link).replace("label",r._label).replace("href",r._href).replace("title",r._title).getRegex(),r.reflink=o(r.reflink).replace("label",r._label).getRegex(),r.normal=g({},r),r.pedantic=g({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:o(/^!?\[(label)\]\((.*?)\)/).replace("label",r._label).getRegex(),reflink:o(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",r._label).getRegex()}),r.gfm=g({},r.normal,{escape:o(r.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:o(r.text).replace("]|","~]|").replace("|$","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|$").getRegex()}),r.gfm.url=o(r.gfm.url,"i").replace("email",r.gfm._extended_email).getRegex(),r.breaks=g({},r.gfm,{br:o(r.br).replace("{2,}","*").getRegex(),text:o(r.gfm.text).replace("{2,}","*").getRegex()}),c.rules=r,c.output=function(e,t,r){return new c(t,r).output(e)},c.prototype.output=function(e){for(var t,r,n,i,o,l,s="";e;)if(o=this.rules.escape.exec(e))e=e.substring(o[0].length),s+=h(o[1]);else if(o=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(o[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(o[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(o[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(o[0])&&(this.inRawBlock=!1),e=e.substring(o[0].length),s+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(o[0]):h(o[0]):o[0];else if(o=this.rules.link.exec(e)){var a=m(o[2],"()");if(-1<a){var u=o[2].length-a;o[2]=o[2].substring(0,a),o[0]=o[0].substring(0,o[0].length-u)}e=e.substring(o[0].length),this.inLink=!0,n=o[2],i=this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n))?(n=t[1],t[3]):"":o[3]?o[3].slice(1,-1):"",n=n.trim().replace(/^<([\s\S]*)>$/,"$1"),s+=this.outputLink(o,{href:c.escapes(n),title:c.escapes(i)}),this.inLink=!1}else if((o=this.rules.reflink.exec(e))||(o=this.rules.nolink.exec(e))){if(e=e.substring(o[0].length),t=(o[2]||o[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){s+=o[0].charAt(0),e=o[0].substring(1)+e;continue}this.inLink=!0,s+=this.outputLink(o,t),this.inLink=!1}else if(o=this.rules.strong.exec(e))e=e.substring(o[0].length),s+=this.renderer.strong(this.output(o[4]||o[3]||o[2]||o[1]));else if(o=this.rules.em.exec(e))e=e.substring(o[0].length),s+=this.renderer.em(this.output(o[6]||o[5]||o[4]||o[3]||o[2]||o[1]));else if(o=this.rules.code.exec(e))e=e.substring(o[0].length),s+=this.renderer.codespan(h(o[2].trim(),!0));else if(o=this.rules.br.exec(e))e=e.substring(o[0].length),s+=this.renderer.br();else if(o=this.rules.del.exec(e))e=e.substring(o[0].length),s+=this.renderer.del(this.output(o[1]));else if(o=this.rules.autolink.exec(e))e=e.substring(o[0].length),n="@"===o[2]?"mailto:"+(r=h(this.mangle(o[1]))):r=h(o[1]),s+=this.renderer.link(n,null,r);else if(this.inLink||!(o=this.rules.url.exec(e))){if(o=this.rules.text.exec(e))e=e.substring(o[0].length),this.inRawBlock?s+=this.renderer.text(o[0]):s+=this.renderer.text(h(this.smartypants(o[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===o[2])n="mailto:"+(r=h(o[0]));else{for(;l=o[0],o[0]=this.rules._backpedal.exec(o[0])[0],l!==o[0];);r=h(o[0]),n="www."===o[1]?"http://"+r:r}e=e.substring(o[0].length),s+=this.renderer.link(n,null,r)}return s},c.escapes=function(e){return e?e.replace(c.rules._escapes,"$1"):e},c.prototype.outputLink=function(e,t){var r=t.href,n=t.title?h(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(r,n,this.output(e[1])):this.renderer.image(r,n,h(e[1]))},c.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"").replace(/--/g,"").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"").replace(/\.{3}/g,""):e},c.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,r="",n=e.length,i=0;i<n;i++)t=e.charCodeAt(i),.5<Math.random()&&(t="x"+t.toString(16)),r+="&#"+t+";";return r},n.prototype.code=function(e,t,r){var n=(t||"").match(/\S*/)[0];if(this.options.highlight){var i=this.options.highlight(e,n);null!=i&&i!==e&&(r=!0,e=i)}return n?'<pre><code class="'+this.options.langPrefix+h(n,!0)+'">'+(r?e:h(e,!0))+"</code></pre>\n":"<pre><code>"+(r?e:h(e,!0))+"</code></pre>"},n.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},n.prototype.html=function(e){return e},n.prototype.heading=function(e,t,r,n){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+n.slug(r)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},n.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},n.prototype.list=function(e,t,r){var n=t?"ol":"ul";return"<"+n+(t&&1!==r?' start="'+r+'"':"")+">\n"+e+"</"+n+">\n"},n.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},n.prototype.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},n.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},n.prototype.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},n.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},n.prototype.tablecell=function(e,t){var r=t.header?"th":"td";return(t.align?"<"+r+' align="'+t.align+'">':"<"+r+">")+e+"</"+r+">\n"},n.prototype.strong=function(e){return"<strong>"+e+"</strong>"},n.prototype.em=function(e){return"<em>"+e+"</em>"},n.prototype.codespan=function(e){return"<code>"+e+"</code>"},n.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},n.prototype.del=function(e){return"<del>"+e+"</del>"},n.prototype.link=function(e,t,r){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return r;var n='<a href="'+h(e)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+r+"</a>"},n.prototype.image=function(e,t,r){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return r;var n='<img src="'+e+'" alt="'+r+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},n.prototype.text=function(e){return e},i.prototype.strong=i.prototype.em=i.prototype.codespan=i.prototype.del=i.prototype.text=function(e){return e},i.prototype.link=i.prototype.image=function(e,t,r){return""+r},i.prototype.br=function(){return""},u.parse=function(e,t){return new u(t).parse(e)},u.prototype.parse=function(e){this.inline=new c(e.links,this.options),this.inlineText=new c(e.links,g({},this.options,{renderer:new i})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},u.prototype.next=function(){return this.token=this.tokens.pop()},u.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},u.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},u.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,d(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,r,n,i="",o="";for(r="",e=0;e<this.token.header.length;e++)r+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(i+=this.renderer.tablerow(r),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],r="",n=0;n<t.length;n++)r+=this.renderer.tablecell(this.inline.output(t[n]),{header:!1,align:this.token.align[n]});o+=this.renderer.tablerow(r)}return this.renderer.table(i,o);case"blockquote_start":for(o="";"blockquote_end"!==this.next().type;)o+=this.tok();return this.renderer.blockquote(o);case"list_start":o="";for(var l=this.token.ordered,s=this.token.start;"list_end"!==this.next().type;)o+=this.tok();return this.renderer.list(o,l,s);case"list_item_start":o="";var a=this.token.loose;for(this.token.task&&(o+=this.renderer.checkbox(this.token.checked));"list_item_end"!==this.next().type;)o+=a||"text"!==this.token.type?this.tok():this.parseText();return this.renderer.listitem(o);case"html":return this.renderer.html(this.token.text);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText());default:var u='Token with "'+this.token.type+'" type was not found.';if(!this.options.silent)throw new Error(u);console.log(u)}},t.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var r=t;this.seen[r]++,t=r+"-"+this.seen[r],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},h.escapeTest=/[&<>"']/,h.escapeReplace=/[&<>"']/g,h.replacements={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},h.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,h.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var s={},f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(){}function g(e){for(var t,r,n=1;n<arguments.length;n++)for(r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}function b(e,t){var r=e.replace(/\|/g,function(e,t,r){for(var n=!1,i=t;0<=--i&&"\\"===r[i];)n=!n;return n?"|":" |"}).split(/ \|/),n=0;if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r}function k(e,t,r){if(0===e.length)return"";for(var n=0;n<e.length;){var i=e.charAt(e.length-n-1);if(i!==t||r){if(i===t||!r)break;n++}else n++}return e.substr(0,e.length-n)}function m(e,t){if(-1===e.indexOf(t[1]))return-1;for(var r=0,n=0;n<e.length;n++)if("\\"===e[n])n++;else if(e[n]===t[0])r++;else if(e[n]===t[1]&&--r<0)return n;return-1}function v(e,r,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if(n||"function"==typeof r){n||(n=r,r=null);var i,o,l=(r=g({},v.defaults,r||{})).highlight,t=0;try{i=a.lex(e,r)}catch(e){return n(e)}o=i.length;var s=function(t){if(t)return r.highlight=l,n(t);var e;try{e=u.parse(i,r)}catch(e){t=e}return r.highlight=l,t?n(t):n(null,e)};if(!l||l.length<3)return s();if(delete r.highlight,!o)return s();for(;t<i.length;t++)!function(r){"code"!==r.type?--o||s():l(r.text,r.lang,function(e,t){return e?s(e):null==t||t===r.text?--o||s():(r.text=t,r.escaped=!0,void(--o||s()))})}(i[t])}else try{return r&&(r=g({},v.defaults,r)),u.parse(a.lex(e,r),r)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(r||v.defaults).silent)return"<p>An error occurred:</p><pre>"+h(e.message+"",!0)+"</pre>";throw e}}p.exec=p,v.options=v.setOptions=function(e){return g(v.defaults,e),v},v.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new n,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},v.defaults=v.getDefaults(),v.Parser=u,v.parser=u.parse,v.Renderer=n,v.TextRenderer=i,v.Lexer=a,v.lexer=a.lex,v.InlineLexer=c,v.inlineLexer=c.output,v.Slugger=t,v.parse=v,"undefined"!=typeof module&&"object"==typeof exports?module.exports=v:"function"==typeof define&&define.amd?define(function(){return v}):e.marked=v}(this||("undefined"!=typeof window?window:global)),function(e){var t;window.UIkit2&&(t=e(UIkit2)),"function"==typeof define&&define.amd&&define("uikit-htmleditor",["uikit"],function(){return t||e(UIkit2)})}(function(s){"use strict";var t=[];return s.component("htmleditor",{defaults:{iframe:!1,mode:"split",markdown:!1,autocomplete:!0,enablescripts:!1,height:500,maxsplitsize:1e3,codemirror:{mode:"htmlmixed",lineWrapping:!0,dragDrop:!1,autoCloseTags:!0,matchTags:!0,autoCloseBrackets:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!1,tabSize:4,hintOptions:{completionSingle:!1}},toolbar:["bold","italic","strike","link","image","blockquote","listUl","listOl"],lblPreview:"Preview",lblCodeview:"HTML",lblMarkedview:"Markdown"},boot:function(){s.ready(function(e){s.$("textarea[data-uk-htmleditor]",e).each(function(){var e=s.$(this);e.data("htmleditor")||s.htmleditor(e,s.Utils.options(e.attr("data-uk-htmleditor")))})})},init:function(){var n=this,e=s.components.htmleditor.template;this.CodeMirror=this.options.CodeMirror||CodeMirror,this.buttons={},e=(e=e.replace(/\{:lblPreview}/g,this.options.lblPreview)).replace(/\{:lblCodeview}/g,this.options.lblCodeview),this.htmleditor=s.$(e),this.content=this.htmleditor.find(".uk-htmleditor-content"),this.toolbar=this.htmleditor.find(".uk-htmleditor-toolbar"),this.preview=this.htmleditor.find(".uk-htmleditor-preview").children().eq(0),this.code=this.htmleditor.find(".uk-htmleditor-code"),this.element.before(this.htmleditor).appendTo(this.code),this.editor=this.CodeMirror.fromTextArea(this.element[0],this.options.codemirror),(this.editor.htmleditor=this).editor.on("change",s.Utils.debounce(function(){n.render()},150)),this.editor.on("change",function(){n.editor.save(),n.element.trigger("input")}),this.code.find(".CodeMirror").css("height",this.options.height),this.options.iframe?(this.iframe=s.$('<iframe class="uk-htmleditor-iframe" frameborder="0" scrolling="auto" height="100" width="100%"></iframe>'),this.preview.append(this.iframe),this.iframe[0].contentWindow.document.open(),this.iframe[0].contentWindow.document.close(),this.preview.container=s.$(this.iframe[0].contentWindow.document).find("body"),"string"==typeof this.options.iframe&&this.preview.container.parent().append('<link rel="stylesheet" href="'+this.options.iframe+'">')):this.preview.container=this.preview,s.$win.on("resize load",s.Utils.debounce(function(){n.fit()},200));var i=this.iframe?this.preview.container:n.preview.parent(),o=this.code.find(".CodeMirror-sizer"),l=this.code.find(".CodeMirror-scroll").on("scroll",s.Utils.debounce(function(){if("tab"!=n.htmleditor.attr("data-mode")){var e=o.height()-l.height(),t=(i[0].scrollHeight-(n.iframe?n.iframe.height():i.height()))/e,r=l.scrollTop()*t;i.scrollTop(r)}},10));this.htmleditor.on("click",".uk-htmleditor-button-code, .uk-htmleditor-button-preview",function(e){e.preventDefault(),"tab"==n.htmleditor.attr("data-mode")&&(n.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter(this).addClass("uk-active"),n.activetab=s.$(this).hasClass("uk-htmleditor-button-code")?"code":"preview",n.htmleditor.attr("data-active-tab",n.activetab),n.editor.refresh())}),this.htmleditor.on("click","a[data-htmleditor-button]",function(){n.code.is(":visible")&&n.trigger("action."+s.$(this).data("htmleditor-button"),[n.editor])}),this.preview.parent().css("height",this.code.height()),this.options.autocomplete&&this.CodeMirror.showHint&&this.CodeMirror.hint&&this.CodeMirror.hint.html&&this.editor.on("inputRead",s.Utils.debounce(function(){var e=n.editor.getDoc().getCursor();if("xml"==n.CodeMirror.innerMode(n.editor.getMode(),n.editor.getTokenAt(e).state).mode.name){var t=n.editor.getCursor(),r=n.editor.getTokenAt(t);"<"!=r.string.charAt(0)&&"attribute"!=r.type||n.CodeMirror.showHint(n.editor,n.CodeMirror.hint.html,{completeSingle:!1})}},100)),this.debouncedRedraw=s.Utils.debounce(function(){n.redraw()},5),this.on("init.uk.component",function(){n.debouncedRedraw()}),this.element.attr("data-uk-check-display",1).on("display.uk.check",function(e){this.htmleditor.is(":visible")&&this.fit()}.bind(this)),t.push(this)},addButton:function(e,t){this.buttons[e]=t},addButtons:function(e){s.$.extend(this.buttons,e)},replaceInPreview:function(e,r){var n=this.editor,i=[],o=n.getValue(),l=-1,s=0;function a(e){var t=n.getValue().substring(0,e).split("\n");return{line:t.length-1,ch:t[t.length-1].length}}return this.currentvalue=this.currentvalue.replace(e,function(){var t={matches:arguments,from:a(l=o.indexOf(arguments[0],++l)),to:a(l+arguments[0].length),replace:function(e){n.replaceRange(e,t.from,t.to)},inRange:function(e){return e.line===t.from.line&&e.line===t.to.line?e.ch>=t.from.ch&&e.ch<t.to.ch:e.line===t.from.line&&e.ch>=t.from.ch||e.line>t.from.line&&e.line<t.to.line||e.line===t.to.line&&e.ch<t.to.ch}},e="string"==typeof r?r:r(t,s);return e||""===e?(s++,i.push(t),e):arguments[0]}),i},_buildtoolbar:function(){if(this.options.toolbar&&this.options.toolbar.length){var r=this,n=[];this.toolbar.empty(),this.options.toolbar.forEach(function(e){if(r.buttons[e]){var t=r.buttons[e].title?r.buttons[e].title:e;n.push('<li><a data-htmleditor-button="'+e+'" title="'+t+'" data-uk-tooltip>'+r.buttons[e].label+"</a></li>")}}),this.toolbar.html(n.join("\n"))}},fit:function(){var e=this.options.mode;"split"==e&&this.htmleditor.width()<this.options.maxsplitsize&&(e="tab"),"tab"==e&&(this.activetab||(this.activetab="code",this.htmleditor.attr("data-active-tab",this.activetab)),this.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter("code"==this.activetab?".uk-htmleditor-button-code":".uk-htmleditor-button-preview").addClass("uk-active")),this.editor.refresh(),this.preview.parent().css("height",this.code.height()),this.htmleditor.attr("data-mode",e)},redraw:function(){this._buildtoolbar(),this.render(),this.fit()},getMode:function(){return this.editor.getOption("mode")},getCursorMode:function(){var e={mode:"html"};return this.trigger("cursorMode",[e]),e.mode},render:function(){if(this.currentvalue=this.editor.getValue(),this.options.enablescripts||(this.currentvalue=this.currentvalue.replace(/<(script|style)\b[^<]*(?:(?!<\/(script|style)>)<[^<]*)*<\/(script|style)>/gim,"")),!this.currentvalue)return this.element.val(""),void this.preview.container.html("");this.trigger("render",[this]),this.trigger("renderLate",[this]),this.preview.container.html(this.currentvalue)},addShortcut:function(e,t){var r={};return s.$.isArray(e)||(e=[e]),e.forEach(function(e){r[e]=t}),this.editor.addKeyMap(r),r},addShortcutAction:function(e,t){var r=this;this.addShortcut(t,function(){r.element.trigger("action."+e,[r.editor])})},replaceSelection:function(e){var t=this.editor.getSelection();if(!t.length){for(var r=this.editor.getCursor(),n=this.editor.getLine(r.line),i=r.ch,o=i;o<n.length&&/[\w$]+/.test(n.charAt(o));)++o;for(;i&&/[\w$]+/.test(n.charAt(i-1));)--i;var l=i!=o&&n.slice(i,o);l&&(this.editor.setSelection({line:r.line,ch:i},{line:r.line,ch:o}),t=l)}var s=e.replace("$1",t);this.editor.replaceSelection(s,"end"),this.editor.focus()},replaceLine:function(e){var t=this.editor.getDoc().getCursor(),r=this.editor.getLine(t.line),n=e.replace("$1",r);this.editor.replaceRange(n,{line:t.line,ch:0},{line:t.line,ch:r.length}),this.editor.setCursor({line:t.line,ch:n.length}),this.editor.focus()},save:function(){this.editor.save()}}),s.components.htmleditor.template=['<div class="uk-htmleditor uk-clearfix" data-mode="split">','<div class="uk-htmleditor-navbar">','<ul class="uk-htmleditor-navbar-nav uk-htmleditor-toolbar"></ul>','<div class="uk-htmleditor-navbar-flip">','<ul class="uk-htmleditor-navbar-nav">','<li class="uk-htmleditor-button-code"><a>{:lblCodeview}</a></li>','<li class="uk-htmleditor-button-preview"><a>{:lblPreview}</a></li>','<li><a data-htmleditor-button="fullscreen"><i class="uk-icon-expand"></i></a></li>',"</ul>","</div>","</div>",'<div class="uk-htmleditor-content">','<div class="uk-htmleditor-code"></div>','<div class="uk-htmleditor-preview"><div></div></div>',"</div>","</div>"].join(""),s.plugin("htmleditor","base",{init:function(a){a.addButtons({fullscreen:{title:"Fullscreen",label:'<i class="uk-icon-expand"></i>'},bold:{title:"Bold",label:'<i class="uk-icon-bold"></i>'},italic:{title:"Italic",label:'<i class="uk-icon-italic"></i>'},strike:{title:"Strikethrough",label:'<i class="uk-icon-strikethrough"></i>'},blockquote:{title:"Blockquote",label:'<i class="uk-icon-quote-right"></i>'},link:{title:"Link",label:'<i class="uk-icon-link"></i>'},image:{title:"Image",label:'<i class="uk-icon-picture-o"></i>'},listUl:{title:"Unordered List",label:'<i class="uk-icon-list-ul"></i>'},listOl:{title:"Ordered List",label:'<i class="uk-icon-list-ol"></i>'}}),t("bold","<strong>$1</strong>"),t("italic","<em>$1</em>"),t("strike","<del>$1</del>"),t("blockquote","<blockquote><p>$1</p></blockquote>","replaceLine"),t("link",'<a href="http://">$1</a>'),t("image",'<img src="http://" alt="$1">');var e=function(e){if("html"==a.getCursorMode()){e=e||"ul";for(var t=a.editor,r=t.getDoc(),n=r.getCursor(!0),i=r.getCursor(!1),o=CodeMirror.innerMode(t.getMode(),t.getTokenAt(t.getCursor()).state),l=o&&o.state&&o.state.context&&-1!=["ul","ol"].indexOf(o.state.context.tagName),s=n.line;s<i.line+1;s++)t.replaceRange("<li>"+t.getLine(s)+"</li>",{line:s,ch:0},{line:s,ch:t.getLine(s).length});l?t.setCursor({line:i.line,ch:t.getLine(i.line).length}):(t.replaceRange("<"+e+">\n"+t.getLine(n.line),{line:n.line,ch:0},{line:n.line,ch:t.getLine(n.line).length}),t.replaceRange(t.getLine(i.line+1)+"\n</"+e+">",{line:i.line+1,ch:0},{line:i.line+1,ch:t.getLine(i.line+1).length}),t.setCursor({line:i.line+1,ch:t.getLine(i.line+1).length})),t.focus()}};function t(e,t,r){a.on("action."+e,function(){"html"==a.getCursorMode()&&a["replaceLine"==r?"replaceLine":"replaceSelection"](t)})}a.on("action.listUl",function(){e("ul")}),a.on("action.listOl",function(){e("ol")}),a.htmleditor.on("click",'a[data-htmleditor-button="fullscreen"]',function(){a.htmleditor.toggleClass("uk-htmleditor-fullscreen");var e=a.editor.getWrapperElement();if(a.htmleditor.hasClass("uk-htmleditor-fullscreen")){var t=!1,r=a.htmleditor.parents().each(function(){"fixed"!=s.$(this).css("position")||s.$(this).is("html")||(t=s.$(this))});if(a.htmleditor.data("fixedParents",!1),t){var n=[];t=t.parent().find(r).each(function(){"none"!=s.$(this).css("transform")&&n.push(s.$(this).data("transform-reset",{transform:this.style.transform,"-webkit-transform":this.style.webkitTransform,"-webkit-transition":this.style.webkitTransition,transition:this.style.transition}).css({transform:"none","-webkit-transform":"none","-webkit-transition":"none",transition:"none"}))}),a.htmleditor.data("fixedParents",n)}a.editor.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:e.style.width,height:e.style.height},e.style.width="",e.style.height=a.content.height()+"px",document.documentElement.style.overflow="hidden"}else{document.documentElement.style.overflow="";var i=a.editor.state.fullScreenRestore;e.style.width=i.width,e.style.height=i.height,window.scrollTo(i.scrollLeft,i.scrollTop),a.htmleditor.data("fixedParents")&&a.htmleditor.data("fixedParents").forEach(function(e){e.css(e.data("transform-reset"))})}setTimeout(function(){a.fit(),s.$win.trigger("resize")},50)}),a.addShortcut(["Ctrl-S","Cmd-S"],function(){a.element.trigger("htmleditor-save",[a])}),a.addShortcutAction("bold",["Ctrl-B","Cmd-B"])}}),s.plugin("htmleditor","markdown",{init:function(l){var e=l.options.mdparser||window.marked||null;function t(){l.editor.setOption("mode","gfm"),l.htmleditor.find(".uk-htmleditor-button-code a").html(l.options.lblMarkedview)}function r(e,t,r){l.on("action."+e,function(){"markdown"==l.getCursorMode()&&l["replaceLine"==r?"replaceLine":"replaceSelection"](t)})}e&&(l.options.markdown&&t(),r("bold","**$1**"),r("italic","*$1*"),r("strike","~~$1~~"),r("blockquote","> $1","replaceLine"),r("link","[$1](http://)"),r("image","![$1](http://)"),l.on("action.listUl",function(){if("markdown"==l.getCursorMode()){for(var e=l.editor,t=e.getDoc().getCursor(!0),r=e.getDoc().getCursor(!1),n=t.line;n<r.line+1;n++)e.replaceRange("* "+e.getLine(n),{line:n,ch:0},{line:n,ch:e.getLine(n).length});e.setCursor({line:r.line,ch:e.getLine(r.line).length}),e.focus()}}),l.on("action.listOl",function(){if("markdown"==l.getCursorMode()){var e,t=l.editor,r=t.getDoc().getCursor(!0),n=t.getDoc().getCursor(!1),i=1;if(0<r.line)(e=t.getLine(r.line-1).match(/^(\d+)\./))&&(i=Number(e[1])+1);for(var o=r.line;o<n.line+1;o++)t.replaceRange(i+". "+t.getLine(o),{line:o,ch:0},{line:o,ch:t.getLine(o).length}),i++;t.setCursor({line:n.line,ch:t.getLine(n.line).length}),t.focus()}}),l.on("renderLate",function(){"gfm"==l.editor.options.mode&&(l.currentvalue=e(l.currentvalue))}),l.on("cursorMode",function(e,t){if("gfm"==l.editor.options.mode){var r=l.editor.getDoc().getCursor();l.editor.getTokenAt(r).state.base.htmlState||(t.mode="markdown")}}),s.$.extend(l,{enableMarkdown:function(){t(),this.render()},disableMarkdown:function(){this.editor.setOption("mode","htmlmixed"),this.htmleditor.find(".uk-htmleditor-button-code a").html(this.options.lblCodeview),this.render()}}),l.on({enableMarkdown:function(){l.enableMarkdown()},disableMarkdown:function(){l.disableMarkdown()}}))}}),s.htmleditor});
(10-10/10)