Files
DinQuant/frontend/dist/js/762.e3a47300.js
T
Dinger de3fd0945b v3.0.1
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-04-06 23:19:41 +08:00

1 line
184 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(self["webpackChunkvue_antd_pro"]=self["webpackChunkvue_antd_pro"]||[]).push([[762],{55218:function(e,t,n){(function(e){e(n(15237))})(function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},n=e.Pos;function r(e,n){return"pairs"==n&&"string"==typeof e?e:"object"==typeof e&&null!=e[n]?e[n]:t[n]}e.defineOption("autoCloseBrackets",!1,function(t,n,l){l&&l!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),n&&(o(r(n,"pairs")),t.state.closeBrackets=n,t.addKeyMap(i))});var i={Backspace:s,Enter:u};function o(e){for(var t=0;t<e.length;t++){var n=e.charAt(t),r="'"+n+"'";i[r]||(i[r]=l(n))}}function l(e){return function(t){return f(t,e)}}function a(e){var t=e.state.closeBrackets;if(!t||t.override)return t;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function s(t){var i=a(t);if(!i||t.getOption("disableInput"))return e.Pass;for(var o=r(i,"pairs"),l=t.listSelections(),s=0;s<l.length;s++){if(!l[s].empty())return e.Pass;var u=d(t,l[s].head);if(!u||o.indexOf(u)%2!=0)return e.Pass}for(s=l.length-1;s>=0;s--){var c=l[s].head;t.replaceRange("",n(c.line,c.ch-1),n(c.line,c.ch+1),"+delete")}}function u(t){var n=a(t),i=n&&r(n,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var o=t.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return e.Pass;var s=d(t,o[l].head);if(!s||i.indexOf(s)%2!=0)return e.Pass}t.operation(function(){var e=t.lineSeparator()||"\n";t.replaceSelection(e+e,null),c(t,-1),o=t.listSelections();for(var n=0;n<o.length;n++){var r=o[n].head.line;t.indentLine(r,null,!0),t.indentLine(r+1,null,!0)}})}function c(e,t){for(var n=[],r=e.listSelections(),i=0,o=0;o<r.length;o++){var l=r[o];l.head==e.getCursor()&&(i=o);var a=l.head.ch||t>0?{line:l.head.line,ch:l.head.ch+t}:{line:l.head.line-1};n.push({anchor:a,head:a})}e.setSelections(n,i)}function h(t){var r=e.cmpPos(t.anchor,t.head)>0;return{anchor:new n(t.anchor.line,t.anchor.ch+(r?-1:1)),head:new n(t.head.line,t.head.ch+(r?1:-1))}}function f(t,i){var o=a(t);if(!o||t.getOption("disableInput"))return e.Pass;var l=r(o,"pairs"),s=l.indexOf(i);if(-1==s)return e.Pass;for(var u,f=r(o,"closeBefore"),d=r(o,"triples"),g=l.charAt(s+1)==i,v=t.listSelections(),m=s%2==0,y=0;y<v.length;y++){var b,w=v[y],x=w.head,C=t.getRange(x,n(x.line,x.ch+1));if(m&&!w.empty())b="surround";else if(!g&&m||C!=i)if(g&&x.ch>1&&d.indexOf(i)>=0&&t.getRange(n(x.line,x.ch-2),x)==i+i){if(x.ch>2&&/\bstring/.test(t.getTokenTypeAt(n(x.line,x.ch-2))))return e.Pass;b="addFour"}else if(g){var S=0==x.ch?" ":t.getRange(n(x.line,x.ch-1),x);if(e.isWordChar(C)||S==i||e.isWordChar(S))return e.Pass;b="both"}else{if(!m||!(0===C.length||/\s/.test(C)||f.indexOf(C)>-1))return e.Pass;b="both"}else b=g&&p(t,x)?"both":d.indexOf(i)>=0&&t.getRange(x,n(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=b)return e.Pass}else u=b}var k=s%2?l.charAt(s-1):i,L=s%2?i:l.charAt(s+1);t.operation(function(){if("skip"==u)c(t,1);else if("skipThree"==u)c(t,3);else if("surround"==u){for(var e=t.getSelections(),n=0;n<e.length;n++)e[n]=k+e[n]+L;t.replaceSelections(e,"around"),e=t.listSelections().slice();for(n=0;n<e.length;n++)e[n]=h(e[n]);t.setSelections(e)}else"both"==u?(t.replaceSelection(k+L,null),t.triggerElectric(k+L),c(t,-1)):"addFour"==u&&(t.replaceSelection(k+k+k+k,"before"),c(t,1))})}function d(e,t){var r=e.getRange(n(t.line,t.ch-1),n(t.line,t.ch+1));return 2==r.length?r:null}function p(e,t){var r=e.getTokenAt(n(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}o(t.pairs+"`")})},97923:function(e,t,n){(function(e){e(n(15237))})(function(e){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),n=e.Pos,r={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function i(e){return e&&e.bracketRegex||/[(){}[\]]/}function o(e,t,o){var a=e.getLineHandle(t.line),s=t.ch-1,u=o&&o.afterCursor;null==u&&(u=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var c=i(o),h=!u&&s>=0&&c.test(a.text.charAt(s))&&r[a.text.charAt(s)]||c.test(a.text.charAt(s+1))&&r[a.text.charAt(++s)];if(!h)return null;var f=">"==h.charAt(1)?1:-1;if(o&&o.strict&&f>0!=(s==t.ch))return null;var d=e.getTokenTypeAt(n(t.line,s+1)),p=l(e,n(t.line,s+(f>0?1:0)),f,d,o);return null==p?null:{from:n(t.line,s),to:p&&p.pos,match:p&&p.ch==h.charAt(0),forward:f>0}}function l(e,t,o,l,a){for(var s=a&&a.maxScanLineLength||1e4,u=a&&a.maxScanLines||1e3,c=[],h=i(a),f=o>0?Math.min(t.line+u,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-u),d=t.line;d!=f;d+=o){var p=e.getLine(d);if(p){var g=o>0?0:p.length-1,v=o>0?p.length:-1;if(!(p.length>s))for(d==t.line&&(g=t.ch-(o<0?1:0));g!=v;g+=o){var m=p.charAt(g);if(h.test(m)&&(void 0===l||(e.getTokenTypeAt(n(d,g+1))||"")==(l||""))){var y=r[m];if(y&&">"==y.charAt(1)==o>0)c.push(m);else{if(!c.length)return{pos:n(d,g),ch:m};c.pop()}}}}}return d-o!=(o>0?e.lastLine():e.firstLine())&&null}function a(e,r,i){for(var l=e.state.matchBrackets.maxHighlightLineLength||1e3,a=i&&i.highlightNonMatching,s=[],u=e.listSelections(),c=0;c<u.length;c++){var h=u[c].empty()&&o(e,u[c].head,i);if(h&&(h.match||!1!==a)&&e.getLine(h.from.line).length<=l){var f=h.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(h.from,n(h.from.line,h.from.ch+1),{className:f})),h.to&&e.getLine(h.to.line).length<=l&&s.push(e.markText(h.to,n(h.to.line,h.to.ch+1),{className:f}))}}if(s.length){t&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(!r)return d;setTimeout(d,800)}}function s(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=a(e,!1,e.state.matchBrackets)})}function u(e){e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)}e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.off("cursorActivity",s),t.off("focus",s),t.off("blur",u),u(t)),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",s),t.on("focus",s),t.on("blur",u))}),e.defineExtension("matchBrackets",function(){a(this,!0)}),e.defineExtension("findMatchingBracket",function(e,t,n){return(n||"boolean"==typeof t)&&(n?(n.strict=t,t=n):t=t?{strict:!0}:null),o(this,e,t)}),e.defineExtension("scanForBracket",function(e,t,n,r){return l(this,e,t,n,r)})})},50436:function(e,t,n){(function(e){e(n(15237))})(function(e){"use strict";var t="CodeMirror-activeline",n="CodeMirror-activeline-background",r="CodeMirror-activeline-gutter";function i(e){for(var i=0;i<e.state.activeLines.length;i++)e.removeLineClass(e.state.activeLines[i],"wrap",t),e.removeLineClass(e.state.activeLines[i],"background",n),e.removeLineClass(e.state.activeLines[i],"gutter",r)}function o(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function l(e,l){for(var a=[],s=0;s<l.length;s++){var u=l[s],c=e.getOption("styleActiveLine");if("object"==typeof c&&c.nonEmpty?u.anchor.line==u.head.line:u.empty()){var h=e.getLineHandleVisualStart(u.head.line);a[a.length-1]!=h&&a.push(h)}}o(e.state.activeLines,a)||e.operation(function(){i(e);for(var o=0;o<a.length;o++)e.addLineClass(a[o],"wrap",t),e.addLineClass(a[o],"background",n),e.addLineClass(a[o],"gutter",r);e.state.activeLines=a})}function a(e,t){l(e,t.ranges)}e.defineOption("styleActiveLine",!1,function(t,n,r){var o=r!=e.Init&&r;n!=o&&(o&&(t.off("beforeSelectionChange",a),i(t),delete t.state.activeLines),n&&(t.state.activeLines=[],l(t,t.listSelections()),t.on("beforeSelectionChange",a)))})})},15237:function(e){(function(t,n){e.exports=n()})(0,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=r||i||o,a=l&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),u=s&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\/(\d+)/.exec(e),h=c&&+c[1],f=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),g=/PhantomJS/.test(e),v=d&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),m=/Android/.test(e),y=v||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),b=v||/Mac/.test(t),w=/\bCrOS\b/.test(e),x=/win/i.test(t),C=f&&e.match(/Version\/(\d*\.\d*)/);C&&(C=Number(C[1])),C&&C>=15&&(f=!1,s=!0);var S=b&&(u||f&&(null==C||C<12.11)),k=n||l&&a>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T,M=function(e,t){var n=e.className,r=L(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function N(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function A(e,t){return N(e).appendChild(t)}function O(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function D(e,t,n,r){var i=O(e,t,n,r);return i.setAttribute("role","presentation"),i}function W(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 H(e){var t,n=e.ownerDocument||e;try{t=e.activeElement}catch(r){t=n.body||null}while(t&&t.shadowRoot&&t.shadowRoot.activeElement)t=t.shadowRoot.activeElement;return t}function F(e,t){var n=e.className;L(t).test(n)||(e.className+=(n?" ":"")+t)}function E(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!L(n[r]).test(t)&&(t+=" "+n[r]);return t}T=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var P=function(e){e.select()};function z(e){return e.display.wrapper.ownerDocument}function I(e){return R(e.display.wrapper)}function R(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function B(e){return z(e).defaultView}function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function U(e,t,n){for(var r in t||(t={}),e)!Object.prototype.hasOwnProperty.call(e,r)||!1===n&&Object.prototype.hasOwnProperty.call(t,r)||(t[r]=e[r]);return t}function V(e,t,n,r,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=r||0,l=i||0;;){var a=e.indexOf("\t",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}v?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(t){}});var _=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};function K(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}_.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},_.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};var j=50,X={toString:function(){return"CodeMirror.Pass"}},Y={scroll:!1},$={origin:"*mouse"},q={origin:"+move"};function Z(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var l=o-r;if(o==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var J=[""];function Q(e){while(J.length<=e)J.push(ee(J)+" ");return J[e]}function ee(e){return e[e.length-1]}function te(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ne(e,t,n){var r=0,i=n(t);while(r<e.length&&n(e[r])<=i)r++;e.splice(r,0,t)}function re(){}function ie(e,t){var n;return Object.create?n=Object.create(e):(re.prototype=e,n=new re),t&&U(t,n),n}var oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function le(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function ae(e,t){return t?!!(t.source.indexOf("\\w")>-1&&le(e))||t.test(e):le(e)}function se(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ue=/[\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 ce(e){return e.charCodeAt(0)>=768&&ue.test(e)}function he(e,t,n){while((n<0?t>0:t<e.length)&&ce(e.charAt(t)))t+=n;return t}function fe(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function de(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var pe=null;function ge(e,t,n){var r;pe=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:pe=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:pe=i)}return null!=r?r:pe}var ve=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(e,t,n){this.level=e,this.from=t,this.to=n}return function(e,t){var u="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!r.test(e))return!1;for(var c=e.length,h=[],f=0;f<c;++f)h.push(n(e.charCodeAt(f)));for(var d=0,p=u;d<c;++d){var g=h[d];"m"==g?h[d]=p:p=g}for(var v=0,m=u;v<c;++v){var y=h[v];"1"==y&&"r"==m?h[v]="n":o.test(y)&&(m=y,"r"==y&&(h[v]="R"))}for(var b=1,w=h[0];b<c-1;++b){var x=h[b];"+"==x&&"1"==w&&"1"==h[b+1]?h[b]="1":","!=x||w!=h[b+1]||"1"!=w&&"n"!=w||(h[b]=w),w=x}for(var C=0;C<c;++C){var S=h[C];if(","==S)h[C]="N";else if("%"==S){var k=void 0;for(k=C+1;k<c&&"%"==h[k];++k);for(var L=C&&"!"==h[C-1]||k<c&&"1"==h[k]?"1":"N",T=C;T<k;++T)h[T]=L;C=k-1}}for(var M=0,N=u;M<c;++M){var A=h[M];"L"==N&&"1"==A?h[M]="L":o.test(A)&&(N=A)}for(var O=0;O<c;++O)if(i.test(h[O])){var D=void 0;for(D=O+1;D<c&&i.test(h[D]);++D);for(var W="L"==(O?h[O-1]:u),H="L"==(D<c?h[D]:u),F=W==H?W?"L":"R":u,E=O;E<D;++E)h[E]=F;O=D-1}for(var P,z=[],I=0;I<c;)if(l.test(h[I])){var R=I;for(++I;I<c&&l.test(h[I]);++I);z.push(new s(0,R,I))}else{var B=I,G=z.length,U="rtl"==t?1:0;for(++I;I<c&&"L"!=h[I];++I);for(var V=B;V<I;)if(a.test(h[V])){B<V&&(z.splice(G,0,new s(1,B,V)),G+=U);var _=V;for(++V;V<I&&a.test(h[V]);++V);z.splice(G,0,new s(2,_,V)),G+=U,B=V}else++V;B<I&&z.splice(G,0,new s(1,B,I))}return"ltr"==t&&(1==z[0].level&&(P=e.match(/^\s+/))&&(z[0].from=P[0].length,z.unshift(new s(0,0,P[0].length))),1==ee(z).level&&(P=e.match(/\s+$/))&&(ee(z).to-=P[0].length,z.push(new s(0,c-P[0].length,c)))),"rtl"==t?z.reverse():z}}();function me(e,t){var n=e.order;return null==n&&(n=e.order=ve(e.text,t)),n}var ye=[],be=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||ye).concat(n)}};function we(e,t){return e._handlers&&e._handlers[t]||ye}function xe(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=K(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ce(e,t){var n=we(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Se(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ce(e,n||t.type,e,t),Ae(t)||t.codemirrorIgnore}function ke(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==K(n,t[r])&&n.push(t[r])}function Le(e,t){return we(e,t).length>0}function Te(e){e.prototype.on=function(e,t){be(this,e,t)},e.prototype.off=function(e,t){xe(this,e,t)}}function Me(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ae(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Oe(e){Me(e),Ne(e)}function De(e){return e.target||e.srcElement}function We(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),b&&e.ctrlKey&&1==t&&(t=3),t}var He,Fe,Ee=function(){if(l&&a<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function Pe(e){if(null==He){var t=O("span","");A(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(He=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&a<8))}var n=He?O("span",""):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function ze(e){if(null!=Fe)return Fe;var t=A(e,document.createTextNode("AخA")),n=T(t,0,1).getBoundingClientRect(),r=T(t,1,2).getBoundingClientRect();return N(e),!(!n||n.left==n.right)&&(Fe=r.right-n.right<3)}var Ie=3!="\n\nb".split(/\n/).length?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Re=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Be=function(){var e=O("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Ge=null;function Ue(e){if(null!=Ge)return Ge;var t=A(e,O("span","x")),n=t.getBoundingClientRect(),r=T(t,0,1).getBoundingClientRect();return Ge=Math.abs(n.left-r.left)>1}var Ve={},_e={};function Ke(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ve[e]=t}function je(e,t){_e[e]=t}function Xe(e){if("string"==typeof e&&_e.hasOwnProperty(e))e=_e[e];else if(e&&"string"==typeof e.name&&_e.hasOwnProperty(e.name)){var t=_e[e.name];"string"==typeof t&&(t={name:t}),e=ie(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xe("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ye(e,t){t=Xe(t);var n=Ve[t.name];if(!n)return Ye(e,"text/plain");var r=n(e,t);if($e.hasOwnProperty(t.name)){var i=$e[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var $e={};function qe(e,t){var n=$e.hasOwnProperty(e)?$e[e]:$e[e]={};U(t,n)}function Ze(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Je(e,t){var n;while(e.innerMode){if(n=e.innerMode(t),!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}}function Qe(e,t,n){return!e.startState||e.startState(t,n)}var et=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function tt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");var n=e;while(!n.lines)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function nt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function rt(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function it(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function ot(e){if(null==e.parent)return null;for(var t=e.parent,n=K(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n+t.first}function lt(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var a=e.lines[l],s=a.height;if(t<s)break;t-=s}return n+l}function at(e,t){return t>=e.first&&t<e.first+e.size}function st(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ut(e,t,n){if(void 0===n&&(n=null),!(this instanceof ut))return new ut(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function ht(e,t){return e.sticky==t.sticky&&0==ct(e,t)}function ft(e){return ut(e.line,e.ch)}function dt(e,t){return ct(e,t)<0?t:e}function pt(e,t){return ct(e,t)<0?e:t}function gt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function vt(e,t){if(t.line<e.first)return ut(e.first,0);var n=e.first+e.size-1;return t.line>n?ut(n,tt(e,n).text.length):mt(t,tt(e,t.line).text.length)}function mt(e,t){var n=e.ch;return null==n||n>t?ut(e.line,t):n<0?ut(e.line,0):e}function yt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=vt(e,t[r]);return n}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,n=this.string.charAt(this.pos);if(t="string"==typeof e?n==e:n&&(e.test?e.test(n):e(n)),t)return++this.pos,n},et.prototype.eatWhile=function(e){var t=this.pos;while(this.eat(e));return this.pos>t},et.prototype.eatSpace=function(){var e=this.pos;while(/[\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(t>-1)return this.pos=t,!0},et.prototype.backUp=function(e){this.pos-=e},et.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=V(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},et.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},et.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return!1!==t&&(this.pos+=e.length),!0},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 bt=function(e,t){this.state=e,this.lookAhead=t},wt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function xt(e,t,n,r){var i=[e.state.modeGen],o={};Ot(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var l=n.state,a=function(r){n.baseTokens=i;var a=e.state.overlays[r],s=1,u=0;n.state=!0,Ot(e,t.text,a.mode,n,function(e,t){var n=s;while(u<e){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,u=Math.min(e,r)}if(t)if(a.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;n<s;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+t}},o),n.state=l,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)a(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Ct(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=St(e,ot(t)),i=t.text.length>e.options.maxHighlightLength&&Ze(e.doc.mode,r.state),o=xt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function St(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new wt(r,!0,t);var o=Dt(e,t,n),l=o>r.first&&tt(r,o-1).stateAfter,a=l?wt.fromSaved(r,l,o):new wt(r,Qe(r.mode),o);return r.iter(o,t,function(n){kt(e,n.text,a);var r=a.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?a.save():null,a.nextLine()}),n&&(r.modeFrontier=a.line),a}function kt(e,t,n,r){var i=e.doc.mode,o=new et(t,e.options.tabSize,n);o.start=o.pos=r||0,""==t&&Lt(i,n.state);while(!o.eol())Tt(i,o,n.state),o.start=o.pos}function Lt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Je(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Tt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Je(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}wt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},wt.prototype.baseToken=function(e){if(!this.baseTokens)return null;while(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}},wt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},wt.fromSaved=function(e,t,n){return t instanceof bt?new wt(e,Ze(e.mode,t.state),n,t.lookAhead):new wt(e,Ze(e.mode,t),n)},wt.prototype.save=function(e){var t=!1!==e?Ze(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bt(t,this.maxLookAhead):t};var Mt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Nt(e,t,n,r){var i,o=e.doc,l=o.mode;t=vt(o,t);var a,s=tt(o,t.line),u=St(e,t.line,n),c=new et(s.text,e.options.tabSize,u);r&&(a=[]);while((r||c.pos<t.ch)&&!c.eol())c.start=c.pos,i=Tt(l,c,u.state),r&&a.push(new Mt(c,i,Ze(o.mode,u.state)));return r?a:new Mt(c,i,u.state)}function At(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Ot(e,t,n,r,i,o,l){var a=n.flattenSpans;null==a&&(a=e.options.flattenSpans);var s,u=0,c=null,h=new et(t,e.options.tabSize,r),f=e.options.addModeClass&&[null];""==t&&At(Lt(n,r.state),o);while(!h.eol()){if(h.pos>e.options.maxHighlightLength?(a=!1,l&&kt(e,t,r,h.pos),h.pos=t.length,s=null):s=At(Tt(n,h,r.state,f),o),f){var d=f[0].name;d&&(s="m-"+(s?d+" "+s:d))}if(!a||c!=s){while(u<h.start)u=Math.min(h.start,u+5e3),i(u,c);c=s}h.start=h.pos}while(u<h.pos){var p=Math.min(h.pos,u+5e3);i(p,c),u=p}}function Dt(e,t,n){for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=tt(o,a-1),u=s.stateAfter;if(u&&(!n||a+(u instanceof bt?u.lookAhead:0)<=o.modeFrontier))return a;var c=V(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=a-1,r=c)}return i}function Wt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=tt(e,r).stateAfter;if(i&&(!(i instanceof bt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var Ht=!1,Ft=!1;function Et(){Ht=!0}function Pt(){Ft=!0}function zt(e,t,n){this.marker=e,this.from=t,this.to=n}function It(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Rt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Bt(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function Gt(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&"bookmark"==l.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new zt(l,o.from,s?null:o.to))}}return r}function Ut(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&"bookmark"==l.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new zt(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return r}function Vt(e,t){if(t.full)return null;var n=at(e,t.from.line)&&tt(e,t.from.line).markedSpans,r=at(e,t.to.line)&&tt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,l=0==ct(t.from,t.to),a=Gt(n,i,l),s=Ut(r,o,l),u=1==t.text.length,c=ee(t.text).length+(u?i:0);if(a)for(var h=0;h<a.length;++h){var f=a[h];if(null==f.to){var d=It(s,f.marker);d?u&&(f.to=null==d.to?null:d.to+c):f.to=i}}if(s)for(var p=0;p<s.length;++p){var g=s[p];if(null!=g.to&&(g.to+=c),null==g.from){var v=It(a,g.marker);v||(g.from=c,u&&(a||(a=[])).push(g))}else g.from+=c,u&&(a||(a=[])).push(g)}a&&(a=_t(a)),s&&s!=a&&(s=_t(s));var m=[a];if(!u){var y,b=t.text.length-2;if(b>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(y||(y=[])).push(new zt(a[w].marker,null,null));for(var x=0;x<b;++x)m.push(y);m.push(s)}return m}function _t(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Kt(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=K(r,n)||(r||(r=[])).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var l=r[o],a=l.find(0),s=0;s<i.length;++s){var u=i[s];if(!(ct(u.to,a.from)<0||ct(u.from,a.to)>0)){var c=[s,1],h=ct(u.from,a.from),f=ct(u.to,a.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:a.from}),(f>0||!l.inclusiveRight&&!f)&&c.push({from:a.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function jt(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Xt(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Yt(e){return e.inclusiveLeft?-1:0}function $t(e){return e.inclusiveRight?1:0}function qt(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=ct(r.from,i.from)||Yt(e)-Yt(t);if(o)return-o;var l=ct(r.to,i.to)||$t(e)-$t(t);return l||t.id-e.id}function Zt(e,t){var n,r=Ft&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||qt(n,i.marker)<0)&&(n=i.marker);return n}function Jt(e){return Zt(e,!0)}function Qt(e){return Zt(e,!1)}function en(e,t){var n,r=Ft&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||qt(n,o.marker)<0)&&(n=o.marker)}return n}function tn(e,t,n,r,i){var o=tt(e,t),l=Ft&&o.markedSpans;if(l)for(var a=0;a<l.length;++a){var s=l[a];if(s.marker.collapsed){var u=s.marker.find(0),c=ct(u.from,n)||Yt(s.marker)-Yt(i),h=ct(u.to,r)||$t(s.marker)-$t(i);if(!(c>=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ct(u.to,n)>=0:ct(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ct(u.from,r)<=0:ct(u.from,r)<0)))return!0}}}function nn(e){var t;while(t=Jt(e))e=t.find(-1,!0).line;return e}function rn(e){var t;while(t=Qt(e))e=t.find(1,!0).line;return e}function on(e){var t,n;while(t=Qt(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function ln(e,t){var n=tt(e,t),r=nn(n);return n==r?t:ot(r)}function an(e,t){if(t>e.lastLine())return t;var n,r=tt(e,t);if(!sn(e,r))return t;while(n=Qt(r))r=n.find(1,!0).line;return ot(r)+1}function sn(e,t){var n=Ft&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&un(e,t,r))return!0}}function un(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return un(e,r.line,It(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&un(e,t,i))return!0}function cn(e){e=nn(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var l=0;l<o.children.length;++l){var a=o.children[l];if(a==n)break;t+=a.height}return t}function hn(e){if(0==e.height)return 0;var t,n=e.text.length,r=e;while(t=Jt(r)){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}r=e;while(t=Qt(r)){var o=t.find(0,!0);n-=r.text.length-o.from.ch,r=o.to.line,n+=r.text.length-o.to.ch}return n}function fn(e){var t=e.display,n=e.doc;t.maxLine=tt(n,n.first),t.maxLineLength=hn(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=hn(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}var dn=function(e,t,n){this.text=e,Xt(this,t),this.height=n?n(this):1};function pn(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),jt(e),Xt(e,n);var i=r?r(e):1;i!=e.height&&it(e,i)}function gn(e){e.parent=null,jt(e)}dn.prototype.lineNo=function(){return ot(this)},Te(dn);var vn={},mn={};function yn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?mn:vn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function bn(e,t){var n=D("span",null,null,s?"padding-right: .1px":null),r={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;r.pos=0,r.addToken=xn,ze(e.display.measure)&&(l=me(o,e.doc.direction))&&(r.addToken=Sn(r.addToken,l)),r.map=[];var a=t!=e.display.externalMeasured&&ot(o);Ln(o,r,Ct(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=E(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=E(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Pe(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var u=r.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=E(r.pre.className,r.textClass||"")),r}function wn(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function xn(e,t,n,r,i,o,s){if(t){var u,c=e.splitSpaces?Cn(t,e.trailingSpace):t,h=e.cm.state.specialChars,f=!1;if(h.test(t)){u=document.createDocumentFragment();var d=0;while(1){h.lastIndex=d;var p=h.exec(t),g=p?p.index-d:t.length-d;if(g){var v=document.createTextNode(c.slice(d,d+g));l&&a<9?u.appendChild(O("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;m=u.appendChild(O("span",Q(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?(m=u.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar")),m.setAttribute("cm-text",p[0]),e.col+=1):(m=e.cm.options.specialCharPlaceholder(p[0]),m.setAttribute("cm-text",p[0]),l&&a<9?u.appendChild(O("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),l&&a<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),n||r||i||f||o||s){var w=n||"";r&&(w+=r),i&&(w+=i);var x=O("span",[u],w,o);if(s)for(var C in s)s.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,s[C]);return e.content.appendChild(x)}e.content.appendChild(u)}}function Cn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}function Sn(e,t){return function(n,r,i,o,l,a,s){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,c=u+r.length;;){for(var h=void 0,f=0;f<t.length;f++)if(h=t[f],h.to>u&&h.from<=u)break;if(h.to>=c)return e(n,r,i,o,l,a,s);e(n,r.slice(0,h.to-u),i,o,null,a,s),o=null,r=r.slice(h.to-u),u=h.to}}}function kn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ln(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var l,a,s,u,c,h,f,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){s=u=c=a="",f=null,h=null,m=1/0;for(var y=[],b=void 0,w=0;w<r.length;++w){var x=r[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(s+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((f||(f={})).title=C.title),C.attributes)for(var S in C.attributes)(f||(f={}))[S]=C.attributes[S];C.collapsed&&(!h||qt(h.marker,C)<0)&&(h=x)}else x.from>p&&m>x.from&&(m=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==m&&(u+=" "+b[k]);if(!h||h.from==p)for(var L=0;L<y.length;++L)kn(t,0,y[L]);if(h&&(h.from||0)==p){if(kn(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=d)break;var T=Math.min(d,m);while(1){if(v){var M=p+v.length;if(!h){var N=M>T?v.slice(0,T-p):v;t.addToken(t,N,l?l+s:s,c,p+N.length==m?u:"",a,f)}if(M>=T){v=v.slice(T-p),p=T;break}p=M,c=""}v=i.slice(o,o=n[g++]),l=yn(n[g++],t.cm.options)}}else for(var A=1;A<n.length;A+=2)t.addToken(t,i.slice(o,o=n[A]),yn(n[A+1],t.cm.options))}function Tn(e,t,n){this.line=t,this.rest=on(t),this.size=this.rest?ot(ee(this.rest))-n+1:1,this.node=this.text=null,this.hidden=sn(e,t)}function Mn(e,t,n){for(var r,i=[],o=t;o<n;o=r){var l=new Tn(e.doc,tt(e.doc,o),o);r=o+l.size,i.push(l)}return i}var Nn=null;function An(e){Nn?Nn.ops.push(e):e.ownsGroup=Nn={ops:[e],delayedCallbacks:[]}}function On(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)while(i.cursorActivityCalled<i.cursorActivityHandlers.length)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Dn(e,t){var n=e.ownsGroup;if(n)try{On(n)}finally{Nn=null,t(n)}}var Wn=null;function Hn(e,t){var n=we(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);Nn?r=Nn.delayedCallbacks:Wn?r=Wn:(r=Wn=[],setTimeout(Fn,0));for(var o=function(e){r.push(function(){return n[e].apply(null,i)})},l=0;l<n.length;++l)o(l)}}function Fn(){var e=Wn;Wn=null;for(var t=0;t<e.length;++t)e[t]()}function En(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Rn(e,t):"gutter"==o?Gn(e,t,n,r):"class"==o?Bn(e,t):"widget"==o&&Un(e,t,r)}t.changes=null}function Pn(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&a<8&&(e.node.style.zIndex=2)),e.node}function zn(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=Pn(t);t.background=r.insertBefore(O("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function In(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):bn(e,t)}function Rn(e,t){var n=t.text.className,r=In(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Bn(e,t)):n&&(t.text.className=n)}function Bn(e,t){zn(e,t),t.line.wrapClass?Pn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Gn(e,t,n,r){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=Pn(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=Pn(t),a=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),e.display.input.setUneditable(a),l.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(O("div",st(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var u=e.display.gutterSpecs[s].className,c=o.hasOwnProperty(u)&&o[u];c&&a.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function Un(e,t,n){t.alignable&&(t.alignable=null);for(var r=L("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);_n(e,t,n)}function Vn(e,t,n,r){var i=In(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Bn(e,t),Gn(e,t,n,r),_n(e,t,r),t.node}function _n(e,t,n){if(Kn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Kn(e,t.rest[r],t,n,!1)}function Kn(e,t,n,r,i){if(t.widgets)for(var o=Pn(n),l=0,a=t.widgets;l<a.length;++l){var s=a[l],u=O("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),jn(s,u,n,r),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),Hn(s,"redraw")}}function jn(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Xn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!W(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,O("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Yn(e,t){for(var n=De(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function $n(e){return e.lineSpace.offsetTop}function qn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Zn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,O("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function Jn(e){return j-e.display.nativeBarWidth}function Qn(e){return e.display.scroller.clientWidth-Jn(e)-e.display.barWidth}function er(e){return e.display.scroller.clientHeight-Jn(e)-e.display.barHeight}function tr(e,t,n){var r=e.options.lineWrapping,i=r&&Qn(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),a=0;a<l.length-1;a++){var s=l[a],u=l[a+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function nr(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(ot(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function rr(e,t){t=nn(t);var n=ot(t),r=e.display.externalMeasured=new Tn(e.doc,t,n);r.lineN=n;var i=r.built=bn(e,r);return r.text=i.pre,A(e.display.lineMeasure,i.pre),r}function ir(e,t,n,r){return ar(e,lr(e,t),n,r)}function or(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Br(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function lr(e,t){var n=ot(t),r=or(e,n);r&&!r.text?r=null:r&&r.changes&&(En(e,r,n,Er(e)),e.curOp.forceUpdate=!0),r||(r=rr(e,t));var i=nr(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function ar(e,t,n,r,i){t.before&&(n=-1);var o,l=n+(r||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(tr(e,t.view,t.rect),t.hasHeights=!0),o=fr(e,t,n,r),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var sr,ur={left:0,right:0,top:0,bottom:0};function cr(e,t,n){for(var r,i,o,l,a,s,u=0;u<e.length;u+=3)if(a=e[u],s=e[u+1],t<a?(i=0,o=1,l="left"):t<s?(i=t-a,o=i+1):(u==e.length-3||t==s&&e[u+3]>t)&&(o=s-a,i=o-1,t>=s&&(l="right")),null!=i){if(r=e[u+2],a==s&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft)r=e[2+(u-=3)],l="left";if("right"==n&&i==s-a)while(u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft)r=e[(u+=3)+2],l="right";break}return{node:r,start:i,end:o,collapse:l,coverStart:a,coverEnd:s}}function hr(e,t){var n=ur;if("left"==t){for(var r=0;r<e.length;r++)if((n=e[r]).left!=n.right)break}else for(var i=e.length-1;i>=0;i--)if((n=e[i]).left!=n.right)break;return n}function fr(e,t,n,r){var i,o=cr(t.map,n,r),s=o.node,u=o.start,c=o.end,h=o.collapse;if(3==s.nodeType){for(var f=0;f<4;f++){while(u&&ce(t.line.text.charAt(o.coverStart+u)))--u;while(o.coverStart+c<o.coverEnd&&ce(t.line.text.charAt(o.coverStart+c)))++c;if(i=l&&a<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():hr(T(s,u,c).getClientRects(),r),i.left||i.right||0==u)break;c=u,u-=1,h="right"}l&&a<11&&(i=dr(e.display.measure,i))}else{var d;u>0&&(h=r="right"),i=e.options.lineWrapping&&(d=s.getClientRects()).length>1?d["right"==r?d.length-1:0]:s.getBoundingClientRect()}if(l&&a<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Fr(e.display),top:p.top,bottom:p.bottom}:ur}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b<y.length-1;b++)if(m<y[b])break;var w=b?y[b-1]:0,x=y[b],C={left:("right"==h?i.right:i.left)-t.rect.left,right:("left"==h?i.left:i.right)-t.rect.left,top:w,bottom:x};return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=v),C}function dr(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ue(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function pr(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 gr(e){e.display.externalMeasure=null,N(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)pr(e.display.view[t])}function vr(e){gr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function mr(e){return c&&m?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function yr(e){return c&&m?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function br(e){var t=nn(e),n=t.widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=Xn(n[i]));return r}function wr(e,t,n,r,i){if(!i){var o=br(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var l=cn(t);if("local"==r?l+=$n(e.display):l-=e.display.viewOffset,"page"==r||"window"==r){var a=e.display.lineSpace.getBoundingClientRect();l+=a.top+("window"==r?0:yr(z(e)));var s=a.left+("window"==r?0:mr(z(e)));n.left+=s,n.right+=s}return n.top+=l,n.bottom+=l,n}function xr(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=mr(z(e)),i-=yr(z(e));else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:r-l.left,top:i-l.top}}function Cr(e,t,n,r,i){return r||(r=tt(e.doc,t.line)),wr(e,r,ir(e,r,t.ch,i),n)}function Sr(e,t,n,r,i,o){function l(t,l){var a=ar(e,i,t,l?"right":"left",o);return l?a.left=a.right:a.right=a.left,wr(e,r,a,n)}r=r||tt(e.doc,t.line),i||(i=lr(e,r));var a=me(r,e.doc.direction),s=t.ch,u=t.sticky;if(s>=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return l("before"==u?s-1:s,"before"==u);function c(e,t,n){var r=a[t],i=1==r.level;return l(n?e-1:e,i!=n)}var h=ge(a,s,u),f=pe,d=c(s,h,"before"==u);return null!=f&&(d.other=c(s,f,"before"!=u)),d}function kr(e,t){var n=0;t=vt(e.doc,t),e.options.lineWrapping||(n=Fr(e.display)*t.ch);var r=tt(e.doc,t.line),i=cn(r)+$n(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Lr(e,t,n,r,i){var o=ut(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Tr(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Lr(r.first,0,null,-1,-1);var i=lt(r,n),o=r.first+r.size-1;if(i>o)return Lr(r.first+r.size-1,tt(r,o).text.length,null,1,1);t<0&&(t=0);for(var l=tt(r,i);;){var a=Or(e,l,i,t,n),s=en(l,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==i)return u;l=tt(r,i=u.line)}}function Mr(e,t,n,r){r-=br(t);var i=t.text.length,o=fe(function(t){return ar(e,n,t-1).bottom<=r},i,0);return i=fe(function(t){return ar(e,n,t).top>r},o,i),{begin:o,end:i}}function Nr(e,t,n,r){n||(n=lr(e,t));var i=wr(e,t,ar(e,n,r),"line").top;return Mr(e,t,n,i)}function Ar(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Or(e,t,n,r,i){i-=cn(t);var o=lr(e,t),l=br(t),a=0,s=t.text.length,u=!0,c=me(t,e.doc.direction);if(c){var h=(e.options.lineWrapping?Wr:Dr)(e,t,n,o,c,r,i);u=1!=h.level,a=u?h.from:h.to-1,s=u?h.to:h.from-1}var f,d,p=null,g=null,v=fe(function(t){var n=ar(e,o,t);return n.top+=l,n.bottom+=l,!!Ar(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,g=n),!0)},a,s),m=!1;if(g){var y=r-g.left<g.right-r,b=y==u;v=p+(b?0:1),d=b?"after":"before",f=y?g.left:g.right}else{u||v!=s&&v!=a||v++,d=0==v?"after":v==t.text.length?"before":ar(e,o,v-(u?1:0)).bottom+l<=i==u?"after":"before";var w=Sr(e,ut(n,v,d),"line",t,o);f=w.left,m=i<w.top?-1:i>=w.bottom?1:0}return v=he(t.text,v,1),Lr(n,v,d,m,r-f)}function Dr(e,t,n,r,i,o,l){var a=fe(function(a){var s=i[a],u=1!=s.level;return Ar(Sr(e,ut(n,u?s.to:s.from,u?"before":"after"),"line",t,r),o,l,!0)},0,i.length-1),s=i[a];if(a>0){var u=1!=s.level,c=Sr(e,ut(n,u?s.from:s.to,u?"after":"before"),"line",t,r);Ar(c,o,l,!0)&&c.top>l&&(s=i[a-1])}return s}function Wr(e,t,n,r,i,o,l){var a=Mr(e,t,r,l),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,f=0;f<i.length;f++){var d=i[f];if(!(d.from>=u||d.to<=s)){var p=1!=d.level,g=ar(e,r,p?Math.min(u,d.to)-1:Math.max(s,d.from)).right,v=g<o?o-g+1e9:g-o;(!c||h>v)&&(c=d,h=v)}}return c||(c=i[i.length-1]),c.from<s&&(c={from:s,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function Hr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==sr){sr=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)sr.appendChild(document.createTextNode("x")),sr.appendChild(O("br"));sr.appendChild(document.createTextNode("x"))}A(e.measure,sr);var n=sr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),N(e.measure),n||1}function Fr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),n=O("pre",[t],"CodeMirror-line-like");A(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Er(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;n[a]=o.offsetLeft+o.clientLeft+i,r[a]=o.clientWidth}return{fixedPos:Pr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Pr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function zr(e){var t=Hr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Fr(e.display)-3);return function(i){if(sn(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function Ir(e){var t=e.doc,n=zr(e);t.iter(function(e){var t=n(e);t!=e.height&&it(e,t)})}function Rr(e,t,n,r){var i=e.display;if(!n&&"true"==De(t).getAttribute("cm-not-content"))return null;var o,l,a=i.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,l=t.clientY-a.top}catch(h){return null}var s,u=Tr(e,o,l);if(r&&u.xRel>0&&(s=tt(e.doc,u.line).text).length==u.ch){var c=V(s,s.length,e.options.tabSize)-s.length;u=ut(u.line,Math.max(0,Math.round((o-Zn(e.display).left)/Fr(e.display))-c))}return u}function Br(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Gr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ft&&ln(e.doc,t)<i.viewTo&&Vr(e);else if(n<=i.viewFrom)Ft&&an(e.doc,n+r)>i.viewFrom?Vr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Vr(e);else if(t<=i.viewFrom){var o=_r(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Vr(e)}else if(n>=i.viewTo){var l=_r(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Vr(e)}else{var a=_r(e,t,t,-1),s=_r(e,n,n+r,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Mn(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):Vr(e)}var u=i.externalMeasured;u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function Ur(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Br(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==K(l,n)&&l.push(n)}}}function Vr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function _r(e,t,n,r){var i,o=Br(e,t),l=e.display.view;if(!Ft||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var a=e.display.viewFrom,s=0;s<o;s++)a+=l[s].size;if(a!=t){if(r>0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,n+=i}while(ln(e.doc,n)!=n){if(o==(r<0?0:l.length-1))return null;n+=r*l[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Kr(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Mn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Mn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Br(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Mn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Br(e,n)))),r.viewTo=n}function jr(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function Xr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Yr(e,t){void 0===t&&(t=!0);var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),l=e.options.$customCursor;l&&(t=!0);for(var a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var s=n.sel.ranges[a];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var u=s.empty();if(l){var c=l(e,s);c&&$r(e,c,i)}else(u||e.options.showCursorWhenSelecting)&&$r(e,s.head,i);u||Zr(e,s,o)}}return r}function $r(e,t,n){var r=Sr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(O("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var o=Cr(e,t,"div",null,null),l=o.right-o.left;i.style.width=(l>0?l:e.defaultCharWidth())+"px"}if(r.other){var a=n.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=r.other.left+"px",a.style.top=r.other.top+"px",a.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function qr(e,t){return e.top-t.top||e.left-t.left}function Zr(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),l=Zn(e.display),a=l.left,s=Math.max(r.sizerWidth,Qn(e)-r.sizer.offsetLeft)-l.right,u="ltr"==i.direction;function c(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n height: "+(r-t)+"px"))}function h(t,n,r){var o,l,h=tt(i,t),f=h.text.length;function d(n,r){return Cr(e,ut(t,n),"div",h,r)}function p(t,n,r){var i=Nr(e,h,null,t),o="ltr"==n==("after"==r)?"left":"right",l="after"==r?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1);return d(l,o)[o]}var g=me(h,i.direction);return de(g,n||0,null==r?f:r,function(e,t,i,h){var v="ltr"==i,m=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==n&&0==e,w=null==r&&t==f,x=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var S=(u?b:w)&&x,k=(u?w:b)&&C,L=S?a:(v?m:y).left,T=k?s:(v?y:m).right;c(L,m.top,T-L,m.bottom)}else{var M,N,A,O;v?(M=u&&b&&x?a:m.left,N=u?s:p(e,i,"before"),A=u?a:p(t,i,"after"),O=u&&w&&C?s:y.right):(M=u?p(e,i,"before"):a,N=!u&&b&&x?s:m.right,A=!u&&w&&C?a:y.left,O=u?p(t,i,"after"):s),c(M,m.top,N-M,m.bottom),m.bottom<y.top&&c(a,m.bottom,null,y.top),c(A,y.top,O-A,y.bottom)}(!o||qr(m,o)<0)&&(o=m),qr(y,o)<0&&(o=y),(!l||qr(m,l)<0)&&(l=m),qr(y,l)<0&&(l=y)}),{start:o,end:l}}var f=t.from(),d=t.to();if(f.line==d.line)h(f.line,f.ch,d.ch);else{var p=tt(i,f.line),g=tt(i,d.line),v=nn(p)==nn(g),m=h(f.line,f.ch,v?p.text.length+1:null).end,y=h(d.line,v?0:null,d.ch).start;v&&(m.top<y.top-2?(c(m.right,m.top,null,m.bottom),c(a,y.top,y.left,y.bottom)):c(m.right,m.top,y.left-m.right,m.bottom)),m.bottom<y.top&&c(a,m.bottom,null,y.top)}n.appendChild(o)}function Jr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||ni(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Qr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||ti(e))}function ei(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ni(e))},100)}function ti(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Jr(e))}function ni(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,M(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ri(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,s=0;s<t.view.length;s++){var u=t.view[s],c=e.options.lineWrapping,h=void 0,f=0;if(!u.hidden){if(i+=u.line.height,l&&a<8){var d=u.node.offsetTop+u.node.offsetHeight;h=d-n,n=d}else{var p=u.node.getBoundingClientRect();h=p.bottom-p.top,!c&&u.text.firstChild&&(f=u.text.firstChild.getBoundingClientRect().right-p.left-1)}var g=u.line.height-h;if((g>.005||g<-.005)&&(i<r&&(o-=g),it(u.line,h),ii(u.line),u.rest))for(var v=0;v<u.rest.length;v++)ii(u.rest[v]);if(f>e.display.sizerWidth){var m=Math.ceil(f/Fr(e.display));m>e.display.maxLineLength&&(e.display.maxLineLength=m,e.display.maxLine=u.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function ii(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function oi(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-$n(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=lt(t,r),l=lt(t,i);if(n&&n.ensure){var a=n.ensure.from.line,s=n.ensure.to.line;a<o?(o=a,l=lt(t,cn(tt(t,a))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=l&&(o=lt(t,cn(tt(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function li(e,t){if(!Se(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),null!=i&&!g){var l=O("div","",null,"position: absolute;\n top: "+(t.top-n.viewOffset-$n(e.display))+"px;\n height: "+(t.bottom-t.top+Jn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(i),e.display.lineSpace.removeChild(l)}}}function ai(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?ut(t.line,t.ch+1,"before"):t,t=t.ch?ut(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var l=!1,a=Sr(e,t),s=n&&n!=t?Sr(e,n):a;i={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-r,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+r};var u=ui(e,i),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(vi(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(yi(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(l=!0)),!l)break}return i}function si(e,t){var n=ui(e,t);null!=n.scrollTop&&vi(e,n.scrollTop),null!=n.scrollLeft&&yi(e,n.scrollLeft)}function ui(e,t){var n=e.display,r=Hr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=er(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+qn(n),s=t.top<r,u=t.bottom>a-r;if(t.top<i)l.scrollTop=s?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?a:t.bottom)-o);c!=i&&(l.scrollTop=c)}var h=e.options.fixedGutter?0:n.gutters.offsetWidth,f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-h,d=Qn(e)-n.gutters.offsetWidth,p=t.right-t.left>d;return p&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left+h-(p?0:10)):t.right>d+f-3&&(l.scrollLeft=t.right+(p?0:10)-d),l}function ci(e,t){null!=t&&(pi(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function hi(e){pi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function fi(e,t,n){null==t&&null==n||pi(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function di(e,t){pi(e),e.curOp.scrollToPos=t}function pi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=kr(e,t.from),r=kr(e,t.to);gi(e,n,r,t.margin)}}function gi(e,t,n,r){var i=ui(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});fi(e,i.scrollLeft,i.scrollTop)}function vi(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||Xi(e,{top:t}),mi(e,t,!0),n&&Xi(e),Ri(e,100))}function mi(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function yi(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Zi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function bi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+qn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Jn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var wi=function(e,t,n){this.cm=n;var r=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),be(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),be(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,l&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};wi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},wi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},wi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},wi.prototype.zeroWidthHack=function(){var e=b&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new _,this.disableVert=new _},wi.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}e.style.visibility="",t.set(1e3,r)},wi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var xi=function(){};function Ci(e,t){t||(t=bi(e));var n=e.display.barWidth,r=e.display.barHeight;Si(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ri(e),Si(e,bi(e)),n=e.display.barWidth,r=e.display.barHeight}function Si(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}xi.prototype.update=function(){return{bottom:0,right:0}},xi.prototype.setScrollLeft=function(){},xi.prototype.setScrollTop=function(){},xi.prototype.clear=function(){};var ki={native:wi,null:xi};function Li(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ki[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),be(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?yi(e,t):vi(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Ti=0;function Mi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ti,markArrays:null},An(e.curOp)}function Ni(e){var t=e.curOp;t&&Dn(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;Ai(e)})}function Ai(e){for(var t=e.ops,n=0;n<t.length;n++)Oi(t[n]);for(var r=0;r<t.length;r++)Di(t[r]);for(var i=0;i<t.length;i++)Wi(t[i]);for(var o=0;o<t.length;o++)Hi(t[o]);for(var l=0;l<t.length;l++)Fi(t[l])}function Oi(e){var t=e.cm,n=t.display;Ui(t),e.updateMaxLine&&fn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Di(e){e.updatedDisplay=e.mustUpdate&&Ki(e.cm,e.update)}function Wi(e){var t=e.cm,n=t.display;e.updatedDisplay&&ri(t),e.barMeasure=bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ir(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Jn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Qn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Hi(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&yi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==H(I(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Ci(t,e.barMeasure),e.updatedDisplay&&qi(t,e.barMeasure),e.selectionChanged&&Jr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Qr(e.cm)}function Fi(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&ji(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&mi(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&yi(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=ai(t,vt(r,e.scrollToPos.from),vt(r,e.scrollToPos.to),e.scrollToPos.margin);li(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var a=0;a<o.length;++a)o[a].lines.length||Ce(o[a],"hide");if(l)for(var s=0;s<l.length;++s)l[s].lines.length&&Ce(l[s],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ce(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ei(e,t){if(e.curOp)return t();Mi(e);try{return t()}finally{Ni(e)}}function Pi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Mi(e);try{return t.apply(e,arguments)}finally{Ni(e)}}}function zi(e){return function(){if(this.curOp)return e.apply(this,arguments);Mi(this);try{return e.apply(this,arguments)}finally{Ni(this)}}}function Ii(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Mi(t);try{return e.apply(this,arguments)}finally{Ni(t)}}}function Ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(Bi,e))}function Bi(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=St(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var l=o.styles,a=o.text.length>e.options.maxHighlightLength?Ze(t.mode,r.state):null,s=xt(e,o,r,!0);a&&(r.state=a),o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!h&&f<l.length;++f)h=l[f]!=o.styles[f];h&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&kt(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Ri(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Ei(e,function(){for(var t=0;t<i.length;t++)Ur(e,i[t],"text")})}}var Gi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=oi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Qn(e),this.force=n,this.dims=Er(e),this.events=[]};function Ui(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Jn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Jn(e)+"px",t.scrollbarsClipped=!0)}function Vi(e){if(e.hasFocus())return null;var t=H(I(e));if(!t||!W(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=B(e).getSelection();r.anchorNode&&r.extend&&W(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function _i(e){if(e&&e.activeElt&&e.activeElt!=H(R(e.activeElt))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&W(document.body,e.anchorNode)&&W(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,n=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),n.removeAllRanges(),n.addRange(r),n.extend(e.focusNode,e.focusOffset)}}function Ki(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Vr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==jr(e))return!1;Ji(e)&&(Vr(e),t.dims=Er(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>l&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),Ft&&(o=ln(e.doc,o),l=an(e.doc,l));var a=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Kr(e,o,l),n.viewOffset=cn(tt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=jr(e);if(!a&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=Vi(e);return s>4&&(n.lineDiv.style.display="none"),Yi(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,_i(u),N(n.cursorDiv),N(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Ri(e,400)),n.updateLineNumbers=null,!0}function ji(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Qn(e))r&&(t.visible=oi(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+qn(e.display)-er(e),n.top)}),t.visible=oi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Ki(e,t))break;ri(e);var i=bi(e);Xr(e),Ci(e,i),qi(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 Xi(e,t){var n=new Gi(e,t);if(Ki(e,n)){ri(e),ji(e,n);var r=bi(e);Xr(e),Ci(e,r),qi(e,r),n.finish()}}function Yi(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,l=o.firstChild;function a(t){var n=t.nextSibling;return s&&b&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,h=0;h<u.length;h++){var f=u[h];if(f.hidden);else if(f.node&&f.node.parentNode==o){while(l!=f.node)l=a(l);var d=i&&null!=t&&t<=c&&f.lineNumber;f.changes&&(K(f.changes,"gutter")>-1&&(d=!1),En(e,f,c,n)),d&&(N(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(st(e.options,c)))),l=f.node.nextSibling}else{var p=Vn(e,f,c,n);o.insertBefore(p,l)}c+=f.size}while(l)l=a(l)}function $i(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Hn(e,"gutterChanged",e)}function qi(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+Jn(e)+"px"}function Zi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Pr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;l<n.length;l++)if(!n[l].hidden){e.options.fixedGutter&&(n[l].gutter&&(n[l].gutter.style.left=o),n[l].gutterBackground&&(n[l].gutterBackground.style.left=o));var a=n[l].alignable;if(a)for(var s=0;s<a.length;s++)a[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Ji(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=st(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(O("div",[O("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-l)+1,r.lineNumWidth=r.lineNumInnerWidth+l,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",$i(e.display),!0}return!1}function Qi(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],l=null;if("string"!=typeof o&&(l=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:l})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function eo(e){var t=e.gutters,n=e.gutterSpecs;N(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,l=i.style,a=t.appendChild(O("div",null,"CodeMirror-gutter "+o));l&&(a.style.cssText=l),"CodeMirror-linenumbers"==o&&(e.lineGutter=a,a.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",$i(e)}function to(e){eo(e.display),Gr(e),Zi(e)}function no(e,t,r,i){var o=this;this.input=r,o.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=D("div",null,"CodeMirror-code"),o.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=O("div",null,"CodeMirror-cursors"),o.measure=O("div",null,"CodeMirror-measure"),o.lineMeasure=O("div",null,"CodeMirror-measure"),o.lineSpace=D("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var u=D("div",[o.lineSpace],"CodeMirror-lines");o.mover=O("div",[u],null,"position: relative"),o.sizer=O("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=O("div",null,null,"position: absolute; height: "+j+"px; width: 1px;"),o.gutters=O("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=O("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=O("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),c&&105===h&&(o.wrapper.style.clipPath="inset(0px)"),o.wrapper.setAttribute("translate","no"),l&&a<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||n&&y||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Qi(i.gutters,i.lineNumbers),eo(o),r.init(o)}Gi.prototype.signal=function(e,t){Le(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ce.apply(null,this.events[e])};var ro=0,io=null;function oo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function lo(e){var t=oo(e);return t.x*=io,t.y*=io,t}function ao(e,t){c&&102==h&&(null==e.display.chromeScrollHack?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var r=oo(t),i=r.x,o=r.y,l=io;0===t.deltaMode&&(i=t.deltaX,o=t.deltaY,l=1);var a=e.display,u=a.scroller,d=u.scrollWidth>u.clientWidth,p=u.scrollHeight>u.clientHeight;if(i&&d||o&&p){if(o&&b&&s)e:for(var g=t.target,v=a.view;g!=u;g=g.parentNode)for(var m=0;m<v.length;m++)if(v[m].node==g){e.display.currentWheelTarget=g;break e}if(i&&!n&&!f&&null!=l)return o&&p&&vi(e,Math.max(0,u.scrollTop+o*l)),yi(e,Math.max(0,u.scrollLeft+i*l)),(!o||o&&p)&&Me(t),void(a.wheelStartX=null);if(o&&null!=l){var y=o*l,w=e.doc.scrollTop,x=w+a.wrapper.clientHeight;y<0?w=Math.max(0,w+y-50):x=Math.min(e.doc.height,x+y+50),Xi(e,{top:w,bottom:x})}ro<20&&0!==t.deltaMode&&(null==a.wheelStartX?(a.wheelStartX=u.scrollLeft,a.wheelStartY=u.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout(function(){if(null!=a.wheelStartX){var e=u.scrollLeft-a.wheelStartX,t=u.scrollTop-a.wheelStartY,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&(io=(io*ro+n)/(ro+1),++ro)}},200)):(a.wheelDX+=i,a.wheelDY+=o))}}l?io=-.53:n?io=15:c?io=-.7:d&&(io=-1/3);var so=function(e,t){this.ranges=e,this.primIndex=t};so.prototype.primary=function(){return this.ranges[this.primIndex]},so.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!ht(n.anchor,r.anchor)||!ht(n.head,r.head))return!1}return!0},so.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new uo(ft(this.ranges[t].anchor),ft(this.ranges[t].head));return new so(e,this.primIndex)},so.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},so.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return n}return-1};var uo=function(e,t){this.anchor=e,this.head=t};function co(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(e,t){return ct(e.from(),t.from())}),n=K(t,i);for(var o=1;o<t.length;o++){var l=t[o],a=t[o-1],s=ct(a.to(),l.from());if(r&&!l.empty()?s>0:s>=0){var u=pt(a.from(),l.from()),c=dt(a.to(),l.to()),h=a.empty()?l.from()==l.head:a.from()==a.head;o<=n&&--n,t.splice(--o,2,new uo(h?c:u,h?u:c))}}return new so(t,n)}function ho(e,t){return new so([new uo(e,t||e)],0)}function fo(e){return e.text?ut(e.from.line+e.text.length-1,ee(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function po(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return fo(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=fo(t).ch-t.to.ch),ut(n,r)}function go(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new uo(po(i.anchor,t),po(i.head,t)))}return co(e.cm,n,e.sel.primIndex)}function vo(e,t,n){return e.line==t.line?ut(n.line,e.ch-t.ch+n.ch):ut(n.line+(e.line-t.line),e.ch)}function mo(e,t,n){for(var r=[],i=ut(e.first,0),o=i,l=0;l<t.length;l++){var a=t[l],s=vo(a.from,i,o),u=vo(fo(a),i,o);if(i=a.to,o=u,"around"==n){var c=e.sel.ranges[l],h=ct(c.head,c.anchor)<0;r[l]=new uo(h?u:s,h?s:u)}else r[l]=new uo(s,s)}return new so(r,e.sel.primIndex)}function yo(e){e.doc.mode=Ye(e.options,e.doc.modeOption),bo(e)}function bo(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,Ri(e,100),e.state.modeGen++,e.curOp&&Gr(e)}function wo(e,t){return 0==t.from.ch&&0==t.to.ch&&""==ee(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function xo(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){pn(e,n,i,r),Hn(e,"change",e,t)}function l(e,t){for(var n=[],o=e;o<t;++o)n.push(new dn(u[o],i(o),r));return n}var a=t.from,s=t.to,u=t.text,c=tt(e,a.line),h=tt(e,s.line),f=ee(u),d=i(u.length-1),p=s.line-a.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(wo(e,t)){var g=l(0,u.length-1);o(h,h.text,d),p&&e.remove(a.line,p),g.length&&e.insert(a.line,g)}else if(c==h)if(1==u.length)o(c,c.text.slice(0,a.ch)+f+c.text.slice(s.ch),d);else{var v=l(1,u.length-1);v.push(new dn(f+c.text.slice(s.ch),d,r)),o(c,c.text.slice(0,a.ch)+u[0],i(0)),e.insert(a.line+1,v)}else if(1==u.length)o(c,c.text.slice(0,a.ch)+u[0]+h.text.slice(s.ch),i(0)),e.remove(a.line+1,p);else{o(c,c.text.slice(0,a.ch)+u[0],i(0)),o(h,f+h.text.slice(s.ch),d);var m=l(1,u.length-1);p>1&&e.remove(a.line+1,p-1),e.insert(a.line+1,m)}Hn(e,"change",e,t)}function Co(e,t,n){function r(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var a=e.linked[l];if(a.doc!=i){var s=o&&a.sharedHist;n&&!s||(t(a.doc,s),r(a.doc,e,s))}}}r(e,null,!0)}function So(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ir(e),yo(e),ko(e),e.options.direction=t.direction,e.options.lineWrapping||fn(e),e.options.mode=t.modeOption,Gr(e)}function ko(e){("rtl"==e.doc.direction?F:M)(e.display.lineDiv,"CodeMirror-rtl")}function Lo(e){Ei(e,function(){ko(e),Gr(e)})}function To(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function Mo(e,t){var n={from:ft(t.from),to:fo(t),text:nt(e,t.from,t.to)};return Fo(e,n,t.from.line,t.to.line+1),Co(e,function(e){return Fo(e,n,t.from.line,t.to.line+1)},!0),n}function No(e){while(e.length){var t=ee(e);if(!t.ranges)break;e.pop()}}function Ao(e,t){return t?(No(e.done),ee(e.done)):e.done.length&&!ee(e.done).ranges?ee(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ee(e.done)):void 0}function Oo(e,t,n,r){var i=e.history;i.undone.length=0;var o,l,a=+new Date;if((i.lastOp==r||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=Ao(i,i.lastOp==r)))l=ee(o.changes),0==ct(t.from,t.to)&&0==ct(t.from,l.to)?l.to=fo(t):o.changes.push(Mo(e,t));else{var s=ee(i.done);s&&s.ranges||Ho(e.sel,i.done),o={changes:[Mo(e,t)],generation:i.generation},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Ce(e,"historyAdded")}function Do(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Wo(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||Do(e,o,ee(i.done),t))?i.done[i.done.length-1]=t:Ho(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&No(i.undone)}function Ho(e,t){var n=ee(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fo(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function Eo(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function Po(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(Eo(n[i]));return r}function zo(e,t){var n=Po(e,t),r=Vt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],l=r[i];if(o&&l)e:for(var a=0;a<l.length;++a){for(var s=l[a],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else l&&(n[i]=l)}return n}function Io(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?so.prototype.deepCopy.call(o):o);else{var l=o.changes,a=[];r.push({changes:a});for(var s=0;s<l.length;++s){var u=l[s],c=void 0;if(a.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&K(t,Number(c[1]))>-1&&(ee(a)[h]=u[h],delete u[h])}}}return r}function Ro(e,t,n,r){if(r){var i=e.anchor;if(n){var o=ct(t,i)<0;o!=ct(n,i)<0?(i=t,t=n):o!=ct(t,n)<0&&(t=n)}return new uo(i,t)}return new uo(n||t,t)}function Bo(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),jo(e,new so([Ro(e.sel.primary(),t,n,i)],0),r)}function Go(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Ro(e.sel.ranges[o],t[o],null,i);var l=co(e.cm,r,e.sel.primIndex);jo(e,l,n)}function Uo(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,jo(e,co(e.cm,i,e.sel.primIndex),r)}function Vo(e,t,n,r){jo(e,ho(t,n),r)}function _o(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new uo(vt(e,t[n].anchor),vt(e,t[n].head))},origin:n&&n.origin};return Ce(e,"beforeSelectionChange",e,r),e.cm&&Ce(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?co(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,n){var r=e.history.done,i=ee(r);i&&i.ranges?(r[r.length-1]=t,Xo(e,t,n)):jo(e,t,n)}function jo(e,t,n){Xo(e,t,n),Wo(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Xo(e,t,n){(Le(e,"beforeSelectionChange")||e.cm&&Le(e.cm,"beforeSelectionChange"))&&(t=_o(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Yo(e,qo(e,t,r,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||hi(e.cm)}function Yo(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ke(e.cm)),Hn(e,"cursorActivity",e))}function $o(e){Yo(e,qo(e,e.sel,null,!1))}function qo(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],a=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=Jo(e,l.anchor,a&&a.anchor,n,r),u=l.head==l.anchor?s:Jo(e,l.head,a&&a.head,n,r);(i||s!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new uo(s,u))}return i?co(e.cm,i,t.primIndex):t}function Zo(e,t,n,r,i){var o=tt(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var a=o.markedSpans[l],s=a.marker,u="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,c="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==a.from||(u?a.from<=t.ch:a.from<t.ch))&&(null==a.to||(c?a.to>=t.ch:a.to>t.ch))){if(i&&(Ce(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!s.atomic)continue;if(n){var h=s.find(r<0?1:-1),f=void 0;if((r<0?c:u)&&(h=Qo(e,h,-r,h&&h.line==t.line?o:null)),h&&h.line==t.line&&(f=ct(h,n))&&(r<0?f<0:f>0))return Zo(e,h,t,r,i)}var d=s.find(r<0?-1:1);return(r<0?u:c)&&(d=Qo(e,d,r,d.line==t.line?o:null)),d?Zo(e,d,t,r,i):null}}return t}function Jo(e,t,n,r,i){var o=r||1,l=Zo(e,t,n,o,i)||!i&&Zo(e,t,n,o,!0)||Zo(e,t,n,-o,i)||!i&&Zo(e,t,n,-o,!0);return l||(e.cantEdit=!0,ut(e.first,0))}function Qo(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?vt(e,ut(t.line-1)):null:n>0&&t.ch==(r||tt(e,t.line)).text.length?t.line<e.first+e.size-1?ut(t.line+1,0):null:new ut(t.line,t.ch+n)}function el(e){e.setSelection(ut(e.firstLine(),0),ut(e.lastLine()),Y)}function tl(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=vt(e,t)),n&&(r.to=vt(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),Ce(e,"beforeChange",e,r),e.cm&&Ce(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function nl(e,t,n){if(e.cm){if(!e.cm.curOp)return Pi(e.cm,nl)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Le(e,"beforeChange")||e.cm&&Le(e.cm,"beforeChange"))||(t=tl(e,t,!0),t)){var r=Ht&&!n&&Kt(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)rl(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else rl(e,t)}}function rl(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ct(t.from,t.to)){var n=go(e,t);Oo(e,t,n,e.cm?e.cm.curOp.id:NaN),ll(e,t,n,Vt(e,t));var r=[];Co(e,function(e,n){n||-1!=K(r,e.history)||(hl(e.history,t),r.push(e.history)),ll(e,t,null,Vt(e,t))})}}function il(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,l=e.sel,a="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u<a.length;u++)if(i=a[u],n?i.ranges&&!i.equals(e.sel):!i.ranges)break;if(u!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(i=a.pop(),!i.ranges){if(r)return void a.push(i);break}if(Ho(i,s),n&&!i.equals(e.sel))return void jo(e,i,{clearRedo:!1});l=i}var c=[];Ho(l,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=Le(e,"beforeChange")||e.cm&&Le(e.cm,"beforeChange"),f=function(n){var r=i.changes[n];if(r.origin=t,h&&!tl(e,r,!1))return a.length=0,{};c.push(Mo(e,r));var o=n?go(e,r):ee(a);ll(e,r,o,zo(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:fo(r)});var l=[];Co(e,function(e,t){t||-1!=K(l,e.history)||(hl(e.history,r),l.push(e.history)),ll(e,r,null,zo(e,r))})},d=i.changes.length-1;d>=0;--d){var p=f(d);if(p)return p.v}}}}function ol(e,t){if(0!=t&&(e.first+=t,e.sel=new so(te(e.sel.ranges,function(e){return new uo(ut(e.anchor.line+t,e.anchor.ch),ut(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Gr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Ur(e.cm,r,"gutter")}}function ll(e,t,n,r){if(e.cm&&!e.cm.curOp)return Pi(e.cm,ll)(e,t,n,r);if(t.to.line<e.first)ol(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);ol(e,i),t={from:ut(e.first,0),to:ut(t.to.line+i,t.to.ch),text:[ee(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ut(o,tt(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=nt(e,t.from,t.to),n||(n=go(e,t)),e.cm?al(e.cm,t,r):xo(e,t,r),Xo(e,n,Y),e.cantEdit&&Jo(e,ut(e.firstLine(),0))&&(e.cantEdit=!1)}}function al(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=ot(nn(tt(r,o.line))),r.iter(s,l.line+1,function(e){if(e==i.maxLine)return a=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ke(e),xo(r,t,n,zr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(e){var t=hn(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),Wt(r,o.line),Ri(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?Gr(e):o.line!=l.line||1!=t.text.length||wo(e.doc,t)?Gr(e,o.line,l.line+1,u):Ur(e,o.line,"text");var c=Le(e,"changes"),h=Le(e,"change");if(h||c){var f={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&Hn(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function sl(e,t,n,r,i){var o;r||(r=n),ct(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),nl(e,{from:n,to:r,text:t,origin:i})}function ul(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function cl(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var a=0;a<o.ranges.length;a++)ul(o.ranges[a].anchor,t,n,r),ul(o.ranges[a].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s];if(n<u.from.line)u.from=ut(u.from.line+r,u.from.ch),u.to=ut(u.to.line+r,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function hl(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;cl(e.done,n,r,i),cl(e.undone,n,r,i)}function fl(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=tt(e,gt(e,t)):i=ot(t),null==i?null:(r(o,i)&&e.cm&&Ur(e.cm,i,n),o)}function dl(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function pl(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}uo.prototype.from=function(){return pt(this.anchor,this.head)},uo.prototype.to=function(){return dt(this.anchor,this.head)},uo.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},dl.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,gn(i),Hn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},pl.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),l=r.height;if(r.removeInner(e,o),this.height-=l-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof dl))){var a=[];this.collapse(a),this.children=[new dl(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,a=l;a<i.lines.length;){var s=new dl(i.lines.slice(a,a+=25));i.height-=s.height,this.children.splice(++r,0,s),s.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=e.children.splice(e.children.length-5,5),n=new pl(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=K(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new pl(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,n))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var gl=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};function vl(e,t,n){cn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ci(e,n)}function ml(e,t,n,r){var i=new gl(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),fl(e,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!sn(e,t)){var r=cn(t)<e.scrollTop;it(t,t.height+Xn(i)),r&&ci(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&Hn(o,"lineWidgetAdded",o,i,"number"==typeof t?t:ot(t)),i}gl.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=ot(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=Xn(this);it(n,Math.max(0,n.height-o)),e&&(Ei(e,function(){vl(e,n,-o),Ur(e,r,"widget")}),Hn(e,"lineWidgetCleared",e,this,r))}},gl.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Xn(this)-t;i&&(sn(this.doc,r)||it(r,r.height+i),n&&Ei(n,function(){n.curOp.forceUpdate=!0,vl(n,r,i),Hn(n,"lineWidgetChanged",n,e,ot(r))}))},Te(gl);var yl=0,bl=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++yl};function wl(e,t,n,r,i){if(r&&r.shared)return Cl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Pi(e.cm,wl)(e,t,n,r,i);var o=new bl(e,i),l=ct(t,n);if(r&&U(r,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(tn(e,t.line,t,n,o)||t.line!=n.line&&tn(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pt()}o.addToHistory&&Oo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,s=t.line,u=e.cm;if(e.iter(s,n.line+1,function(r){u&&o.collapsed&&!u.options.lineWrapping&&nn(r)==u.display.maxLine&&(a=!0),o.collapsed&&s!=t.line&&it(r,0),Bt(r,new zt(o,s==t.line?t.ch:null,s==n.line?n.ch:null),e.cm&&e.cm.curOp),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){sn(e,t)&&it(t,0)}),o.clearOnEnter&&be(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Et(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++yl,o.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),o.collapsed)Gr(u,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)Ur(u,c,"text");o.atomic&&$o(u.doc),Hn(u,"markerAdded",u,o)}return o}bl.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Mi(e),Le(this,"clear")){var n=this.find();n&&Hn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],a=It(l.markedSpans,this);e&&!this.collapsed?Ur(e,ot(l),"text"):e&&(null!=a.to&&(i=ot(l)),null!=a.from&&(r=ot(l))),l.markedSpans=Rt(l.markedSpans,a),null==a.from&&this.collapsed&&!sn(this.doc,l)&&e&&it(l,Hr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var u=nn(this.lines[s]),c=hn(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Gr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$o(e.doc)),e&&Hn(e,"markerCleared",e,this,r,i),t&&Ni(e),this.parent&&this.parent.clear()}},bl.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=It(o.markedSpans,this);if(null!=l.from&&(n=ut(t?o:ot(o),l.from),-1==e))return n;if(null!=l.to&&(r=ut(t?o:ot(o),l.to),1==e))return r}return n&&{from:n,to:r}},bl.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;t&&r&&Ei(r,function(){var i=t.line,o=ot(t.line),l=or(r,o);if(l&&(pr(l),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!sn(n.doc,i)&&null!=n.height){var a=n.height;n.height=null;var s=Xn(n)-a;s&&it(i,i.height+s)}Hn(r,"markerChanged",r,e)})},bl.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=K(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},bl.prototype.detachLine=function(e){if(this.lines.splice(K(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Te(bl);var xl=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function Cl(e,t,n,r,i){r=U(r),r.shared=!1;var o=[wl(e,t,n,r,i)],l=o[0],a=r.widgetNode;return Co(e,function(e){a&&(r.widgetNode=a.cloneNode(!0)),o.push(wl(e,vt(e,t),vt(e,n),r,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;l=ee(o)}),new xl(o,l)}function Sl(e){return e.findMarks(ut(e.first,0),e.clipPos(ut(e.lastLine())),function(e){return e.parent})}function kl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(ct(o,l)){var a=wl(e,o,l,r.primary,r.primary.type);r.markers.push(a),a.parent=r}}}function Ll(e){for(var t=function(t){var n=e[t],r=[n.primary.doc];Co(n.primary.doc,function(e){return r.push(e)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==K(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}xl.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Hn(this,"clear")}},xl.prototype.find=function(e,t){return this.primary.find(e,t)},Te(xl);var Tl=0,Ml=function(e,t,n,r,i){if(!(this instanceof Ml))return new Ml(e,t,n,r,i);null==n&&(n=0),pl.call(this,[new dl([new dn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=ut(n,0);this.sel=ho(o),this.history=new To(null),this.id=++Tl,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),xo(this,{from:o,to:o,text:e}),jo(this,ho(o),Y)};Ml.prototype=ie(pl.prototype,{constructor:Ml,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=rt(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Ii(function(e){var t=ut(this.first,0),n=this.first+this.size-1;nl(this,{from:t,to:ut(n,tt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&fi(this.cm,0,0),jo(this,ho(t),Y)}),replaceRange:function(e,t,n,r){t=vt(this,t),n=n?vt(this,n):t,sl(this,e,t,n,r)},getRange:function(e,t,n){var r=nt(this,vt(this,e),vt(this,t));return!1===n?r:""===n?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(at(this,e))return tt(this,e)},getLineNumber:function(e){return ot(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=tt(this,e)),nn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return vt(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||!1===e?n.to():n.from(),t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Ii(function(e,t,n){Vo(this,vt(this,"number"==typeof e?ut(e,t||0):e),null,n)}),setSelection:Ii(function(e,t,n){Vo(this,vt(this,e),vt(this,t||e),n)}),extendSelection:Ii(function(e,t,n){Bo(this,vt(this,e),t&&vt(this,t),n)}),extendSelections:Ii(function(e,t){Go(this,yt(this,e),t)}),extendSelectionsBy:Ii(function(e,t){var n=te(this.sel.ranges,e);Go(this,yt(this,n),t)}),setSelections:Ii(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new uo(vt(this,e[i].anchor),vt(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),jo(this,co(this.cm,r,t),n)}}),addSelection:Ii(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new uo(vt(this,e),vt(this,t||e))),jo(this,co(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=nt(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=nt(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Ii(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];r[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:n}}for(var a=t&&"end"!=t&&mo(this,r,t),s=r.length-1;s>=0;s--)nl(this,r[s]);a?Ko(this,a):this.cm&&hi(this.cm)}),undo:Ii(function(){il(this,"undo")}),redo:Ii(function(){il(this,"redo")}),undoSelection:Ii(function(){il(this,"undo",!0)}),redoSelection:Ii(function(){il(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new To(this.history),Co(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Io(this.history.done),undone:Io(this.history.undone)}},setHistory:function(e){var t=this.history=new To(this.history);t.done=Io(e.done.slice(0),null,!0),t.undone=Io(e.undone.slice(0),null,!0)},setGutterMarker:Ii(function(e,t,n){return fl(this,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&se(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Ii(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&fl(t,n,"gutter",function(){return n.gutterMarkers[e]=null,se(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!at(this,e))return null;if(t=e,e=tt(this,e),!e)return null}else if(t=ot(e),null==t)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:Ii(function(e,t,n){return fl(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(L(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:Ii(function(e,t,n){return fl(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.match(L(n));if(!o)return!1;var l=o.index+o[0].length;e[r]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:Ii(function(e,t,n){return ml(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return wl(this,vt(this,e),vt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=vt(this,e),wl(this,e,e,n,"bookmark")},findMarksAt:function(e){e=vt(this,e);var t=[],n=tt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=vt(this,e),t=vt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var a=0;a<l.length;a++){var s=l[a];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+r;if(o>e)return t=e,!0;e-=o,++n}),vt(this,ut(n,t))},indexFromPos:function(e){e=vt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Ml(rt(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,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Ml(rt(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],kl(r,Sl(this)),r},unlinkDoc:function(e){if(e instanceof Ga&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Ll(Sl(this));break}}if(e.history==this.history){var r=[e.id];Co(e,function(e){return r.push(e.id)},!0),e.history=new To(null),e.history.done=Io(this.history.done,r),e.history.undone=Io(this.history.undone,r)}},iterLinkedDocs:function(e){Co(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ie(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Ii(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Lo(this.cm))})}),Ml.prototype.eachLine=Ml.prototype.iter;var Nl=0;function Al(e){var t=this;if(Wl(t),!Se(t,e)&&!Yn(t.display,e)){Me(e),l&&(Nl=+new Date);var n=Rr(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,s=function(){++a==i&&Pi(t,function(){n=vt(t.doc,n);var e={from:n,to:n,text:t.doc.splitLines(o.filter(function(e){return null!=e}).join(t.doc.lineSeparator())),origin:"paste"};nl(t.doc,e),Ko(t.doc,ho(vt(t.doc,n),vt(t.doc,fo(e))))})()},u=function(e,n){if(t.options.allowDropFileTypes&&-1==K(t.options.allowDropFileTypes,e.type))s();else{var r=new FileReader;r.onerror=function(){return s()},r.onload=function(){var e=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[n]=e),s()},r.readAsText(e)}},c=0;c<r.length;c++)u(r[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var h=e.dataTransfer.getData("Text");if(h){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Xo(t.doc,ho(n,n)),f)for(var d=0;d<f.length;++d)sl(t.doc,"",f[d].anchor,f[d].head,"drag");t.replaceSelection(h,"around","paste"),t.display.input.focus()}}catch(p){}}}}function Ol(e,t){if(l&&(!e.state.draggingText||+new Date-Nl<100))Oe(t);else if(!Se(e,t)&&!Yn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var n=O("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=Rr(e,t);if(n){var r=document.createDocumentFragment();$r(e,n,r),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,r)}}function Wl(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Hl(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var t=0;t<n.length;t++)e(n[t])})}}var Fl=!1;function El(){Fl||(Pl(),Fl=!0)}function Pl(){var e;be(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Hl(zl)},100))}),be(window,"blur",function(){return Hl(ni)})}function zl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Il={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Rl=0;Rl<10;Rl++)Il[Rl+48]=Il[Rl+96]=String(Rl);for(var Bl=65;Bl<=90;Bl++)Il[Bl]=String.fromCharCode(Bl);for(var Gl=1;Gl<=12;Gl++)Il[Gl+111]=Il[Gl+63235]="F"+Gl;var Ul={};function Vl(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var a=o[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function _l(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=te(n.split(" "),Vl),o=0;o<i.length;o++){var l=void 0,a=void 0;o==i.length-1?(a=i.join(" "),l=r):(a=i.slice(0,o+1).join(" "),l="...");var s=t[a];if(s){if(s!=l)throw new Error("Inconsistent bindings for "+a)}else t[a]=l}delete e[n]}for(var u in t)e[u]=t[u];return e}function Kl(e,t,n,r){t=$l(t);var i=t.call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Kl(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var l=Kl(e,t.fallthrough[o],n,r);if(l)return l}}}function jl(e){var t="string"==typeof e?e:Il[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Xl(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(S?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(S?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function Yl(e,t){if(f&&34==e.keyCode&&e["char"])return!1;var n=Il[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),Xl(n,e,t))}function $l(e){return"string"==typeof e?Ul[e]:e}function ql(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){var o=t(n[i]);while(r.length&&ct(o.from,ee(r).to)<=0){var l=r.pop();if(ct(l.from,o.from)<0){o.from=l.from;break}}r.push(o)}Ei(e,function(){for(var t=r.length-1;t>=0;t--)sl(e.doc,"",r[t].from,r[t].to,"+delete");hi(e)})}function Zl(e,t,n){var r=he(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Jl(e,t,n){var r=Zl(e,t.ch,n);return null==r?null:new ut(t.line,r,n<0?"after":"before")}function Ql(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=me(n,t.doc.direction);if(o){var l,a=i<0?ee(o):o[0],s=i<0==(1==a.level),u=s?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var c=lr(t,n);l=i<0?n.text.length-1:0;var h=ar(t,c,l).top;l=fe(function(e){return ar(t,c,e).top==h},i<0==(1==a.level)?a.from:a.to-1,l),"before"==u&&(l=Zl(n,l,1))}else l=i<0?a.to:a.from;return new ut(r,l,u)}}return new ut(r,i<0?n.text.length:0,i<0?"before":"after")}function ea(e,t,n,r){var i=me(t,e.doc.direction);if(!i)return Jl(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ge(i,n.ch,n.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(r>0?l.to>n.ch:l.from<n.ch))return Jl(t,n,r);var a,s=function(e,n){return Zl(t,e instanceof ut?e.ch:e,n)},u=function(n){return e.options.lineWrapping?(a=a||lr(e,t),Nr(e,t,a,n)):{begin:0,end:t.text.length}},c=u("before"==n.sticky?s(n,-1):n.ch);if("rtl"==e.doc.direction||1==l.level){var h=1==l.level==r<0,f=s(n,h?1:-1);if(null!=f&&(h?f<=l.to&&f<=c.end:f>=l.from&&f>=c.begin)){var d=h?"before":"after";return new ut(n.line,f,d)}}var p=function(e,t,r){for(var o=function(e,t){return t?new ut(n.line,s(e,1),"before"):new ut(n.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],a=t>0==(1!=l.level),u=a?r.begin:s(r.end,-1);if(l.from<=u&&u<l.to)return o(u,a);if(u=a?l.from:s(l.to,-1),r.begin<=u&&u<r.end)return o(u,a)}},g=p(o+r,r,c);if(g)return g;var v=r>0?c.end:s(c.begin,-1);return null==v||r>0&&v==t.text.length||(g=p(r>0?0:i.length-1,r,u(v)),!g)?null:g}Ul.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"},Ul.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"},Ul.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ul.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"]},Ul["default"]=b?Ul.macDefault:Ul.pcDefault;var ta={selectAll:el,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Y)},killLine:function(e){return ql(e,function(t){if(t.empty()){var n=tt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:ut(t.head.line+1,0)}:{from:t.head,to:ut(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ql(e,function(t){return{from:ut(t.from().line,0),to:vt(e.doc,ut(t.to().line+1,0))}})},delLineLeft:function(e){return ql(e,function(e){return{from:ut(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return ql(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ql(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.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(ut(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ut(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return na(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ia(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return ra(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},q)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},q)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ia(e,t.head):r},q)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),l=V(e.getLine(o.line),o.ch,r);t.push(Q(r-l%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ei(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=tt(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new ut(i.line,i.ch-1)),i.ch>0)i=new ut(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ut(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=tt(e.doc,i.line-1).text;l&&(i=new ut(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ut(i.line-1,l.length-1),i,"+transpose"))}n.push(new uo(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Ei(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);hi(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function na(e,t){var n=tt(e.doc,t),r=nn(n);return r!=n&&(t=ot(r)),Ql(!0,e,r,t,1)}function ra(e,t){var n=tt(e.doc,t),r=rn(n);return r!=n&&(t=ot(r)),Ql(!0,e,n,t,-1)}function ia(e,t){var n=na(e,t.line),r=tt(e.doc,n.line),i=me(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(n.ch,r.text.search(/\S/)),l=t.line==n.line&&t.ch<=o&&t.ch;return ut(n.line,l?0:o,n.sticky)}return n}function oa(e,t,n){if("string"==typeof t&&(t=ta[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=X}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function la(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Kl(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Kl(t,e.options.extraKeys,n,e)||Kl(t,e.options.keyMap,n,e)}var aa=new _;function sa(e,t,n,r){var i=e.state.keySeq;if(i){if(jl(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:aa.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ua(e,i+" "+t,n,r))return!0}return ua(e,t,n,r)}function ua(e,t,n,r){var i=la(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&Hn(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(Me(n),Jr(e)),!!i}function ca(e,t){var n=Yl(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?sa(e,"Shift-"+n,t,function(t){return oa(e,t,!0)})||sa(e,n,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return oa(e,t)}):sa(e,n,t,function(t){return oa(e,t)}))}function ha(e,t,n){return sa(e,"'"+n+"'",t,function(t){return oa(e,t,!0)})}var fa=null;function da(e){var t=this;if((!e.target||e.target==t.display.input.getField())&&(t.curOp.focus=H(I(t)),!Se(t,e))){l&&a<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var i=ca(t,e);f&&(fa=i?r:null,i||88!=r||Be||!(b?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),n&&!b&&!i&&46==r&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||pa(t)}}function pa(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(M(t,"CodeMirror-crosshair"),xe(document,"keyup",n),xe(document,"mouseover",n))}F(t,"CodeMirror-crosshair"),be(document,"keyup",n),be(document,"mouseover",n)}function ga(e){16==e.keyCode&&(this.doc.sel.shift=!1),Se(this,e)}function va(e){var t=this;if((!e.target||e.target==t.display.input.getField())&&!(Yn(t.display,e)||Se(t,e)||e.ctrlKey&&!e.altKey||b&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(f&&n==fa)return fa=null,void Me(e);if(!f||e.which&&!(e.which<10)||!ca(t,e)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(ha(t,e,i)||t.display.input.onKeyPress(e))}}}var ma,ya,ba=400,wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};function xa(e,t){var n=+new Date;return ya&&ya.compare(n,e,t)?(ma=ya=null,"triple"):ma&&ma.compare(n,e,t)?(ya=new wa(n,e,t),ma=null,"double"):(ma=new wa(n,e,t),ya=null,"single")}function Ca(e){var t=this,n=t.display;if(!(Se(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,Yn(n,e))s||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));else if(!Da(t,e)){var r=Rr(t,e),i=We(e),o=r?xa(r,i):"single";B(t).focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&Sa(t,i,r,o,e)||(1==i?r?La(t,r,o,e):De(e)==n.scroller&&Me(e):2==i?(r&&Bo(t.doc,r),setTimeout(function(){return n.input.focus()},20)):3==i&&(k?t.display.input.onContextMenu(e):ei(t)))}}function Sa(e,t,n,r,i){var o="Click";return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),o=(1==t?"Left":2==t?"Middle":"Right")+o,sa(e,Xl(o,i),i,function(t){if("string"==typeof t&&(t=ta[t]),!t)return!1;var r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=X}finally{e.state.suppressEdits=!1}return r})}function ka(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=w?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=b?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(b?n.altKey:n.ctrlKey)),i}function La(e,t,n,r){l?setTimeout(G(Qr,e),0):e.curOp.focus=H(I(e));var i,o=ka(e,n,r),a=e.doc.sel;e.options.dragDrop&&Ee&&!e.isReadOnly()&&"single"==n&&(i=a.contains(t))>-1&&(ct((i=a.ranges[i]).from(),t)<0||t.xRel>0)&&(ct(i.to(),t)>0||t.xRel<0)?Ta(e,r,t,o):Na(e,r,t,o)}function Ta(e,t,n,r){var i=e.display,o=!1,u=Pi(e,function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:ei(e)),xe(i.wrapper.ownerDocument,"mouseup",u),xe(i.wrapper.ownerDocument,"mousemove",c),xe(i.scroller,"dragstart",h),xe(i.scroller,"drop",u),o||(Me(t),r.addNew||Bo(e.doc,n,null,null,r.extend),s&&!d||l&&9==a?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,be(i.wrapper.ownerDocument,"mouseup",u),be(i.wrapper.ownerDocument,"mousemove",c),be(i.scroller,"dragstart",h),be(i.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Ma(e,t,n){if("char"==n)return new uo(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new uo(ut(t.line,0),vt(e.doc,ut(t.line+1,0)));var r=n(e,t);return new uo(r.from,r.to)}function Na(e,t,n,r){l&&ei(e);var i=e.display,o=e.doc;Me(t);var a,s,u=o.sel,c=u.ranges;if(r.addNew&&!r.extend?(s=o.sel.contains(n),a=s>-1?c[s]:new uo(n,n)):(a=o.sel.primary(),s=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new uo(n,n)),n=Rr(e,t,!0,!0),s=-1;else{var h=Ma(e,n,r.unit);a=r.extend?Ro(a,h.anchor,h.head,r.extend):h}r.addNew?-1==s?(s=c.length,jo(o,co(e,c.concat([a]),s),{scroll:!1,origin:"*mouse"})):c.length>1&&c[s].empty()&&"char"==r.unit&&!r.extend?(jo(o,co(e,c.slice(0,s).concat(c.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Uo(o,s,a,$):(s=0,jo(o,new so([a],0),$),u=o.sel);var f=n;function d(t){if(0!=ct(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],l=e.options.tabSize,c=V(tt(o,n.line).text,n.ch,l),h=V(tt(o,t.line).text,t.ch,l),d=Math.min(c,h),p=Math.max(c,h),g=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=v;g++){var m=tt(o,g).text,y=Z(m,d,l);d==p?i.push(new uo(ut(g,y),ut(g,y))):m.length>y&&i.push(new uo(ut(g,y),ut(g,Z(m,p,l))))}i.length||i.push(new uo(n,n)),jo(o,co(e,u.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,x=Ma(e,t,r.unit),C=w.anchor;ct(x.anchor,C)>0?(b=x.head,C=pt(w.from(),x.anchor)):(b=x.anchor,C=dt(w.to(),x.head));var S=u.ranges.slice(0);S[s]=Aa(e,new uo(vt(o,C),b)),jo(o,co(e,S,s),$)}}var p=i.wrapper.getBoundingClientRect(),g=0;function v(t){var n=++g,l=Rr(e,t,!0,"rectangle"==r.unit);if(l)if(0!=ct(l,f)){e.curOp.focus=H(I(e)),d(l);var a=oi(i,o);(l.line>=a.to||l.line<a.from)&&setTimeout(Pi(e,function(){g==n&&v(t)}),150)}else{var s=t.clientY<p.top?-20:t.clientY>p.bottom?20:0;s&&setTimeout(Pi(e,function(){g==n&&(i.scroller.scrollTop+=s,v(t))}),50)}}function m(t){e.state.selectingText=!1,g=1/0,t&&(Me(t),i.input.focus()),xe(i.wrapper.ownerDocument,"mousemove",y),xe(i.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=Pi(e,function(e){0!==e.buttons&&We(e)?v(e):m(e)}),b=Pi(e,m);e.state.selectingText=b,be(i.wrapper.ownerDocument,"mousemove",y),be(i.wrapper.ownerDocument,"mouseup",b)}function Aa(e,t){var n=t.anchor,r=t.head,i=tt(e.doc,n.line);if(0==ct(n,r)&&n.sticky==r.sticky)return t;var o=me(i);if(!o)return t;var l=ge(o,n.ch,n.sticky),a=o[l];if(a.from!=n.ch&&a.to!=n.ch)return t;var s,u=l+(a.from==n.ch==(1!=a.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=ge(o,r.ch,r.sticky),h=c-l||(r.ch-n.ch)*(1==a.level?-1:1);s=c==u-1||c==u?h<0:h>0}var f=o[u+(s?-1:0)],d=s==(1==f.level),p=d?f.from:f.to,g=d?"after":"before";return n.ch==p&&n.sticky==g?t:new uo(new ut(n.line,p,g),r)}function Oa(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(f){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Me(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!Le(e,n))return Ae(t);o-=a.top-l.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var u=l.gutters.childNodes[s];if(u&&u.getBoundingClientRect().right>=i){var c=lt(e.doc,o),h=e.display.gutterSpecs[s];return Ce(e,n,e,c,h.className,t),Ae(t)}}}function Da(e,t){return Oa(e,t,"gutterClick",!0)}function Wa(e,t){Yn(e.display,t)||Ha(e,t)||Se(e,t,"contextmenu")||k||e.display.input.onContextMenu(t)}function Ha(e,t){return!!Le(e,"gutterContextMenu")&&Oa(e,t,"gutterContextMenu",!1)}function Fa(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vr(e)}wa.prototype.compare=function(e,t,n){return this.time+ba>e&&0==ct(t,this.pos)&&n==this.button};var Ea={toString:function(){return"CodeMirror.Init"}},Pa={},za={};function Ia(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=Ea&&i(e,t,n)}:i)}e.defineOption=n,e.Init=Ea,n("value","",function(e,t){return e.setValue(t)},!0),n("mode",null,function(e,t){e.doc.modeOption=t,yo(e)},!0),n("indentUnit",2,yo,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(e){bo(e),vr(e),Gr(e)},!0),n("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(ut(r,o))}r++});for(var i=n.length-1;i>=0;i--)sl(e.doc,t,n[i],ut(n[i].line,n[i].ch+t.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Ea&&e.refresh()}),n("specialCharPlaceholder",wn,function(e){return e.refresh()},!0),n("electricChars",!0),n("inputStyle",y?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),n("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),n("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",function(e){Fa(e),to(e)},!0),n("keyMap","default",function(e,t,n){var r=$l(t),i=n!=Ea&&$l(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ba,!0),n("gutters",[],function(e,t){e.display.gutterSpecs=Qi(t,e.options.lineNumbers),to(e)},!0),n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Pr(e.display)+"px":"0",e.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(e){return Ci(e)},!0),n("scrollbarStyle","native",function(e){Li(e),Ci(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),n("lineNumbers",!1,function(e,t){e.display.gutterSpecs=Qi(e.options.gutters,t),to(e)},!0),n("firstLineNumber",1,to,!0),n("lineNumberFormatter",function(e){return e},to,!0),n("showCursorWhenSelecting",!1,Xr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(e,t){"nocursor"==t&&(ni(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),n("screenReaderLabel",null,function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)}),n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),n("dragDrop",!0,Ra),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Xr,!0),n("singleCursorHeightPerLine",!0,Xr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,bo,!0),n("addModeClass",!1,bo,!0),n("pollInterval",100),n("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),n("historyEventDelay",1250),n("viewportMargin",10,function(e){return e.refresh()},!0),n("maxHighlightLength",1e4,bo,!0),n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),n("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),n("autofocus",null),n("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),n("phrases",null)}function Ra(e,t,n){var r=n&&n!=Ea;if(!t!=!r){var i=e.display.dragFunctions,o=t?be:xe;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Ba(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(M(e.display.wrapper,"CodeMirror-wrap"),fn(e)),Ir(e),Gr(e),vr(e),setTimeout(function(){return Ci(e)},100)}function Ga(e,t){var n=this;if(!(this instanceof Ga))return new Ga(e,t);this.options=t=t?U(t):{},U(Pa,t,!1);var r=t.value;"string"==typeof r?r=new Ml(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Ga.inputStyles[t.inputStyle](this),o=this.display=new no(e,r,i,t);for(var u in o.wrapper.CodeMirror=this,Fa(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Li(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 _,keySeq:null,specialChars:null},t.autofocus&&!y&&o.input.focus(),l&&a<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ua(this),El(),Mi(this),this.curOp.forceUpdate=!0,So(this,r),t.autofocus&&!y||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ti(n)},20):ni(this),za)za.hasOwnProperty(u)&&za[u](this,t[u],Ea);Ji(this),t.finishInit&&t.finishInit(this);for(var c=0;c<Va.length;++c)Va[c](this);Ni(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Ua(e){var t=e.display;be(t.scroller,"mousedown",Pi(e,Ca)),be(t.scroller,"dblclick",l&&a<11?Pi(e,function(t){if(!Se(e,t)){var n=Rr(e,t);if(n&&!Da(e,t)&&!Yn(e.display,t)){Me(t);var r=e.findWordAt(n);Bo(e.doc,r.anchor,r.head)}}}):function(t){return Se(e,t)||Me(t)}),be(t.scroller,"contextmenu",function(t){return Wa(e,t)}),be(t.input.getField(),"contextmenu",function(n){t.scroller.contains(n.target)||Wa(e,n)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}be(t.scroller,"touchstart",function(i){if(!Se(e,i)&&!o(i)&&!Da(e,i)){t.input.ensurePolled(),clearTimeout(n);var l=+new Date;t.activeTouch={start:l,moved:!1,prev:l-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),be(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),be(t.scroller,"touchend",function(n){var r=t.activeTouch;if(r&&!Yn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,l=e.coordsChar(t.activeTouch,"page");o=!r.prev||s(r,r.prev)?new uo(l,l):!r.prev.prev||s(r,r.prev.prev)?e.findWordAt(l):new uo(ut(l.line,0),vt(e.doc,ut(l.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),Me(n)}i()}),be(t.scroller,"touchcancel",i),be(t.scroller,"scroll",function(){t.scroller.clientHeight&&(vi(e,t.scroller.scrollTop),yi(e,t.scroller.scrollLeft,!0),Ce(e,"scroll",e))}),be(t.scroller,"mousewheel",function(t){return ao(e,t)}),be(t.scroller,"DOMMouseScroll",function(t){return ao(e,t)}),be(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){Se(e,t)||Oe(t)},over:function(t){Se(e,t)||(Dl(e,t),Oe(t))},start:function(t){return Ol(e,t)},drop:Pi(e,Al),leave:function(t){Se(e,t)||Wl(e)}};var u=t.input.getField();be(u,"keyup",function(t){return ga.call(e,t)}),be(u,"keydown",Pi(e,da)),be(u,"keypress",Pi(e,va)),be(u,"focus",function(t){return ti(e,t)}),be(u,"blur",function(t){return ni(e,t)})}Ga.defaults=Pa,Ga.optionHandlers=za;var Va=[];function _a(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=St(e,t).state:n="prev");var l=e.options.tabSize,a=tt(o,t),s=V(a.text,null,l);a.stateAfter&&(a.stateAfter=null);var u,c=a.text.match(/^\s*/)[0];if(r||/\S/.test(a.text)){if("smart"==n&&(u=o.mode.indent(i,a.text.slice(c.length),a.text),u==X||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?V(tt(o,t-1).text,null,l):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n),u=Math.max(0,u);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)f+=l,h+="\t";if(f<u&&(h+=Q(u-f)),h!=c)return sl(o,h,ut(t,0),ut(t,c.length),"+input"),a.stateAfter=null,!0;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 v=ut(t,c.length);Uo(o,p,new uo(v,v));break}}}Ga.defineInitHook=function(e){return Va.push(e)};var Ka=null;function ja(e){Ka=e}function Xa(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var l=+new Date-200,a="paste"==i||e.state.pasteIncoming>l,s=Ie(t),u=null;if(a&&r.ranges.length>1)if(Ka&&Ka.text.join("\n")==t){if(r.ranges.length%Ka.text.length==0){u=[];for(var c=0;c<Ka.text.length;c++)u.push(o.splitLines(Ka.text[c]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=te(s,function(e){return[e]}));for(var h=e.curOp.updateInput,f=r.ranges.length-1;f>=0;f--){var d=r.ranges[f],p=d.from(),g=d.to();d.empty()&&(n&&n>0?p=ut(p.line,p.ch-n):e.state.overwrite&&!a?g=ut(g.line,Math.min(tt(o,g.line).text.length,g.ch+ee(s).length)):a&&Ka&&Ka.lineWise&&Ka.text.join("\n")==s.join("\n")&&(p=g=ut(p.line,0)));var v={from:p,to:g,text:u?u[f%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};nl(e.doc,v),Hn(e,"inputRead",e,v)}t&&!a&&$a(e,t),hi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ya(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||!t.hasFocus()||Ei(t,function(){return Xa(t,n,0,null,"paste")}),!0}function $a(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(t.indexOf(o.electricChars.charAt(a))>-1){l=_a(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(tt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=_a(e,i.head.line,"smart"));l&&Hn(e,"electricInput",e,i.head.line)}}}function qa(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:ut(i,0),head:ut(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Za(e,t,n,r){e.setAttribute("autocorrect",n?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function Ja(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),t}function Qa(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){B(this).focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&Pi(this,t[e])(this,n,i),Ce(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"]($l(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:zi(function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");ne(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},function(e){return e.priority}),this.state.modeGen++,Gr(this)}),removeOverlay:zi(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void Gr(this)}}),indentLine:zi(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),at(this.doc,e)&&_a(this,e,t,n)}),indentSelection:zi(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(_a(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&hi(this));else{var o=i.from(),l=i.to(),a=Math.max(n,o.line);n=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var s=a;s<n;++s)_a(this,s,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[r].from().ch>0&&Uo(this.doc,r,new uo(o,u[r].to()),Y)}}}),getTokenAt:function(e,t){return Nt(this,e,t)},getLineTokens:function(e,t){return Nt(this,ut(e),t,!0)},getTokenTypeAt:function(e){e=vt(this.doc,e);var t,n=Ct(this,tt(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=r+i>>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]<o)){t=n[2*l+2];break}r=l+1}}var a=t?t.indexOf("overlay "):-1;return a<0?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!n.hasOwnProperty(t))return r;var i=n[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&r.push(i[o[t]]);else if(o[t])for(var l=0;l<o[t].length;l++){var a=i[o[t][l]];a&&r.push(a)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name]);for(var s=0;s<i._global.length;s++){var u=i._global[s];u.pred(o,this)&&-1==K(r,u.val)&&r.push(u.val)}return r},getStateAfter:function(e,t){var n=this.doc;return e=gt(n,null==e?n.first+n.size-1:e),St(this,e+1,t).state},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?vt(this.doc,e):e?r.from():r.to(),Sr(this,n,t||"page")},charCoords:function(e,t){return Cr(this,vt(this.doc,e),t||"page")},coordsChar:function(e,t){return e=xr(this,e,t||"page"),Tr(this,e.left,e.top)},lineAtHeight:function(e,t){return e=xr(this,{top:e,left:0},t||"page").top,lt(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=tt(this.doc,e)}else r=e;return wr(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-cn(r):0)},defaultTextHeight:function(){return Hr(this.display)},defaultCharWidth:function(){return Fr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=Sr(this,vt(this.doc,e));var l=e.bottom,a=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)l=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(l=e.bottom),a+t.offsetWidth>u&&(a=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?a=0:"middle"==i&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),n&&si(this,{left:a,top:l,right:a+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:zi(da),triggerOnKeyPress:zi(va),triggerOnKeyUp:ga,triggerOnMouseDown:zi(Ca),execCommand:function(e){if(ta.hasOwnProperty(e))return ta[e].call(null,this)},triggerElectric:zi(function(e){$a(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=vt(this.doc,e),l=0;l<t;++l)if(o=es(this.doc,o,i,n,r),o.hitSide)break;return o},moveH:zi(function(e,t){var n=this;this.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?es(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},q)}),deleteH:zi(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):ql(this,function(n){var i=es(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var l=vt(this.doc,e),a=0;a<t;++a){var s=Sr(this,l,"div");if(null==o?o=s.left:s.left=o,l=ts(this,s,i,n),l.hitSide)break}return l},moveV:zi(function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var a=Sr(n,l.head,"div");null!=l.goalColumn&&(a.left=l.goalColumn),i.push(a.left);var s=ts(n,a,e,t);return"page"==t&&l==r.sel.primary()&&ci(n,Cr(n,s,"div").top-a.top),s},q),i.length)for(var l=0;l<r.sel.ranges.length;l++)r.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=this.doc,n=tt(t,e.line).text,r=e.ch,i=e.ch;if(n){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&i!=n.length||!r?++i:--r;var l=n.charAt(r),a=ae(l,o)?function(e){return ae(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ae(e)};while(r>0&&a(n.charAt(r-1)))--r;while(i<n.length&&a(n.charAt(i)))++i}return new uo(ut(e.line,r),ut(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):M(this.display.cursorDiv,"CodeMirror-overwrite"),Ce(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==H(I(this))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:zi(function(e,t){fi(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Jn(this)-this.display.barHeight,width:e.scrollWidth-Jn(this)-this.display.barWidth,clientHeight:er(this),clientWidth:Qn(this)}},scrollIntoView:zi(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ut(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?di(this,e):gi(this,e.from,e.to,e.margin)}),setSize:zi(function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&gr(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){Ur(n,i,"widget");break}++i}),this.curOp.forceUpdate=!0,Ce(this,"refresh",this)}),operation:function(e){return Ei(this,e)},startOperation:function(){return Mi(this)},endOperation:function(){return Ni(this)},refresh:zi(function(){var e=this.display.cachedTextHeight;Gr(this),this.curOp.forceUpdate=!0,vr(this),fi(this,this.doc.scrollLeft,this.doc.scrollTop),$i(this.display),(null==e||Math.abs(e-Hr(this.display))>.5||this.options.lineWrapping)&&Ir(this),Ce(this,"refresh",this)}),swapDoc:zi(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),So(this,e),vr(this),this.display.input.reset(),fi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Hn(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}},Te(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}function es(e,t,n,r,i){var o=t,l=n,a=tt(e,t.line),s=i&&"rtl"==e.direction?-n:n;function u(){var n=t.line+s;return!(n<e.first||n>=e.first+e.size)&&(t=new ut(n,t.ch,t.sticky),a=tt(e,n))}function c(o){var l;if("codepoint"==r){var c=a.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(c))l=null;else{var h=n>0?c>=55296&&c<56320:c>=56320&&c<57343;l=new ut(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*(h?2:1))),-n)}}else l=i?ea(e.cm,a,t,n):Jl(a,t,n);if(null==l){if(o||!u())return!1;t=Ql(i,e.cm,a,t.line,s)}else t=l;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var h=null,f="group"==r,d=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;;p=!1){if(n<0&&!c(!p))break;var g=a.text.charAt(t.ch)||"\n",v=ae(g,d)?"w":f&&"\n"==g?"n":!f||/\s/.test(g)?null:"p";if(!f||p||v||(v="s"),h&&h!=v){n<0&&(n=1,c(),t.sticky="after");break}if(v&&(h=v),n>0&&!c(!p))break}var m=Jo(e,t,o,l,!0);return ht(o,m)&&(m.hitSide=!0),m}function ts(e,t,n,r){var i,o,l=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,B(e).innerHeight||l(e).documentElement.clientHeight),u=Math.max(s-.5*Hr(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){if(o=Tr(e,a,i),!o.outside)break;if(n<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*n}return o}var ns=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new _,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function rs(e,t){var n=or(e,t.line);if(!n||n.hidden)return null;var r=tt(e.doc,t.line),i=nr(n,r,t.line),o=me(r,e.doc.direction),l="left";if(o){var a=ge(o,t.ch);l=a%2?"right":"left"}var s=cr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function is(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function os(e,t){return t&&(e.bad=!0),e}function ls(e,t,n,r,i){var o="",l=!1,a=e.doc.lineSeparator(),s=!1;function u(e){return function(t){return t.id==e}}function c(){l&&(o+=a,s&&(o+=a),l=s=!1)}function h(e){e&&(c(),o+=e)}function f(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void h(n);var o,d=t.getAttribute("cm-marker");if(d){var p=e.findMarks(ut(r,0),ut(i+1,0),u(+d));return void(p.length&&(o=p[0].find(0))&&h(nt(e.doc,o.from,o.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&c();for(var v=0;v<t.childNodes.length;v++)f(t.childNodes[v]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),g&&(l=!0)}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;;){if(f(t),t==n)break;t=t.nextSibling,s=!1}return o}function as(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return os(e.clipPos(ut(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return ss(o,t,n)}}function ss(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!W(r,t))return os(ut(ot(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?ee(e.rest):e.line;return os(ut(ot(o),o.text.length),i)}var l=3==t.nodeType?t:null,a=t;l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));while(a.parentNode!=r)a=a.parentNode;var s=e.measure,u=s.maps;function c(t,n,r){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?s.map:u[i],l=0;l<o.length;l+=3){var a=o[l+2];if(a==t||a==n){var c=ot(i<0?e.line:e.rest[i]),h=o[l]+r;return(r<0||a!=t)&&(h=o[l+(r?1:0)]),ut(c,h)}}}var h=c(l,a,n);if(h)return os(h,i);for(var f=a.nextSibling,d=l?l.nodeValue.length-n:0;f;f=f.nextSibling){if(h=c(f,f.firstChild,0),h)return os(ut(h.line,h.ch-d),i);d+=f.textContent.length}for(var p=a.previousSibling,g=n;p;p=p.previousSibling){if(h=c(p,p.firstChild,-1),h)return os(ut(h.line,h.ch+g),i);g+=p.textContent.length}}ns.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function l(e){if(o(e)&&!Se(r,e)){if(r.somethingSelected())ja({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=qa(r);ja({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Y),r.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var l=Ka.text.join("\n");if(e.clipboardData.setData("Text",l),e.clipboardData.getData("Text")==l)return void e.preventDefault()}var a=Ja(),s=a.firstChild;Za(s),r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),s.value=Ka.text.join("\n");var u=H(R(i));P(s),setTimeout(function(){r.display.lineSpace.removeChild(a),u.focus(),u==i&&n.showPrimarySelection()},50)}}i.contentEditable=!0,Za(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),be(i,"paste",function(e){!o(e)||Se(r,e)||Ya(e,r)||a<=11&&setTimeout(Pi(r,function(){return t.updateFromDOM()}),20)}),be(i,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),be(i,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),be(i,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),be(i,"touchstart",function(){return n.forceCompositionEnd()}),be(i,"input",function(){t.composing||t.readFromDOMSoon()}),be(i,"copy",l),be(i,"cut",l)},ns.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ns.prototype.prepareSelection=function(){var e=Yr(this.cm,!1);return e.focus=H(R(this.div))==this.div,e},ns.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ns.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ns.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),o=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=as(t,e.anchorNode,e.anchorOffset),a=as(t,e.focusNode,e.focusOffset);if(!l||l.bad||!a||a.bad||0!=ct(pt(l,a),i)||0!=ct(dt(l,a),o)){var s=t.display.view,u=i.line>=t.display.viewFrom&&rs(t,i)||{node:s[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&rs(t,o);if(!c){var h=s[s.length-1].measure,f=h.maps?h.maps[h.maps.length-1]:h.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var d,p=e.rangeCount&&e.getRangeAt(0);try{d=T(u.node,u.offset,c.offset,c.node)}catch(g){}d&&(!n&&t.state.focused?(e.collapse(u.node,u.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),p&&null==e.anchorNode?e.addRange(p):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},ns.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)},ns.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},ns.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ns.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return W(this.div,t)},ns.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&H(R(this.div))==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ns.prototype.blur=function(){this.div.blur()},ns.prototype.getField=function(){return this.div},ns.prototype.supportsTouch=function(){return!0},ns.prototype.receivedFocus=function(){var e=this,t=this;function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Ei(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,n)},ns.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ns.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(m&&c&&this.cm.display.gutterSpecs.length&&is(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=as(t,e.anchorNode,e.anchorOffset),r=as(t,e.focusNode,e.focusOffset);n&&r&&Ei(t,function(){jo(t.doc,ho(n,r),Y),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},ns.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),l=o.from(),a=o.to();if(0==l.ch&&l.line>r.firstLine()&&(l=ut(l.line-1,tt(r.doc,l.line-1).length)),a.ch==tt(r.doc,a.line).text.length&&a.line<r.lastLine()&&(a=ut(a.line+1,0)),l.line<i.viewFrom||a.line>i.viewTo-1)return!1;l.line==i.viewFrom||0==(e=Br(r,l.line))?(t=ot(i.view[0].line),n=i.view[0].node):(t=ot(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,u,c=Br(r,a.line);if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=ot(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;var h=r.doc.splitLines(ls(r,n,u,t,s)),f=nt(r.doc,ut(t,0),ut(s,tt(r.doc,s).text.length));while(h.length>1&&f.length>1)if(ee(h)==ee(f))h.pop(),f.pop(),s--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),t++}var d=0,p=0,g=h[0],v=f[0],m=Math.min(g.length,v.length);while(d<m&&g.charCodeAt(d)==v.charCodeAt(d))++d;var y=ee(h),b=ee(f),w=Math.min(y.length-(1==h.length?d:0),b.length-(1==f.length?d:0));while(p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))++p;if(1==h.length&&1==f.length&&t==l.line)while(d&&d>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))d--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(d).replace(/\u200b+$/,"");var x=ut(t,d),C=ut(s,f.length?ee(f).length-p:0);return h.length>1||h[0]||ct(x,C)?(sl(r.doc,h,x,C,"+input"),!0):void 0},ns.prototype.ensurePolled=function(){this.forceCompositionEnd()},ns.prototype.reset=function(){this.forceCompositionEnd()},ns.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ns.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))},ns.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Ei(this.cm,function(){return Gr(e.cm)})},ns.prototype.setUneditable=function(e){e.contentEditable="false"},ns.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Pi(this.cm,Xa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ns.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},ns.prototype.onContextMenu=function(){},ns.prototype.resetPosition=function(){},ns.prototype.needsContentAttribute=!0;var us=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new _,this.hasSelection=!1,this.composing=null,this.resetting=!1};function cs(e,t){if(t=t?U(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=H(R(e));t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=a.getValue()}var i;if(e.form&&(be(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=l}}catch(s){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(xe(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var a=Ga(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return a}function hs(e){e.off=xe,e.on=be,e.wheelEventPixels=lo,e.Doc=Ml,e.splitLines=Ie,e.countColumn=V,e.findColumn=Z,e.isWordChar=le,e.Pass=X,e.signal=Ce,e.Line=dn,e.changeEnd=fo,e.scrollbarModel=ki,e.Pos=ut,e.cmpPos=ct,e.modes=Ve,e.mimeModes=_e,e.resolveMode=Xe,e.getMode=Ye,e.modeExtensions=$e,e.extendMode=qe,e.copyState=Ze,e.startState=Qe,e.innerMode=Je,e.commands=ta,e.keyMap=Ul,e.keyName=Yl,e.isModifierKey=jl,e.lookupKey=Kl,e.normalizeKeyMap=_l,e.StringStream=et,e.SharedTextMarker=xl,e.TextMarker=bl,e.LineWidget=gl,e.e_preventDefault=Me,e.e_stopPropagation=Ne,e.e_stop=Oe,e.addClass=F,e.contains=W,e.rmClass=M,e.keyNames=Il}us.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!Se(r,e)){if(r.somethingSelected())ja({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=qa(r);ja({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,Y):(n.prevInput="",i.value=t.text.join("\n"),P(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),v&&(i.style.width="0px"),be(i,"input",function(){l&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),be(i,"paste",function(e){Se(r,e)||Ya(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())}),be(i,"cut",o),be(i,"copy",o),be(e.scroller,"paste",function(t){if(!Yn(e,t)&&!Se(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}}),be(e.lineSpace,"selectstart",function(t){Yn(e,t)||Me(t)}),be(i,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),be(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},us.prototype.createField=function(e){this.wrapper=Ja(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Za(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},us.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},us.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Yr(e);if(e.options.moveInputWithCursor){var i=Sr(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return r},us.prototype.showSelection=function(e){var t=this.cm,n=t.display;A(n.cursorDiv,e.cursors),A(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},us.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),l&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",l&&a>=9&&(this.hasSelection=null));this.resetting=!1}},us.prototype.getField=function(){return this.textarea},us.prototype.supportsTouch=function(){return!1},us.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!y||H(R(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},us.prototype.blur=function(){this.textarea.blur()},us.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},us.prototype.receivedFocus=function(){this.slowPoll()},us.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},us.prototype.fastPoll=function(){var e=!1,t=this;function n(){var r=t.poll();r||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}t.pollingFast=!0,t.polling.set(20,n)},us.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Re(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(l&&a>=9&&this.hasSelection===i||b&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r=""),8666==o)return this.reset(),this.cm.execCommand("undo")}var s=0,u=Math.min(r.length,i.length);while(s<u&&r.charCodeAt(s)==i.charCodeAt(s))++s;return Ei(t,function(){Xa(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},us.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},us.prototype.onKeyPress=function(){l&&a>=9&&(this.hasSelection=null),this.fastPoll()},us.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Rr(n,e),u=r.scroller.scrollTop;if(o&&!f){var c=n.options.resetSelectionOnContextMenu;c&&-1==n.doc.sel.contains(o)&&Pi(n,jo)(n.doc,ho(o),Y);var h,d=i.style.cssText,p=t.wrapper.style.cssText,g=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(h=i.ownerDocument.defaultView.scrollY),r.input.focus(),s&&i.ownerDocument.defaultView.scrollTo(null,h),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=y,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),l&&a>=9&&m(),k){Oe(e);var v=function(){xe(window,"mouseup",v),setTimeout(y,20)};be(window,"mouseup",v)}else setTimeout(y,50)}function m(){if(null!=i.selectionStart){var e=n.somethingSelected(),o=""+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function y(){if(t.contextMenuPending==y&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,i.style.cssText=d,l&&a<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!l||l&&a<9)&&m();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?Pi(n,el)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},us.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},us.prototype.setUneditable=function(){},us.prototype.needsContentAttribute=!1,Ia(Ga),Qa(Ga);var fs="iter insert remove copy getEditor constructor".split(" ");for(var ds in Ml.prototype)Ml.prototype.hasOwnProperty(ds)&&K(fs,ds)<0&&(Ga.prototype[ds]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ml.prototype[ds]));return Te(Ml),Ga.inputStyles={textarea:us,contenteditable:ns},Ga.defineMode=function(e){Ga.defaults.mode||"null"==e||(Ga.defaults.mode=e),Ke.apply(this,arguments)},Ga.defineMIME=je,Ga.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ga.defineMIME("text/plain","null"),Ga.defineExtension=function(e,t){Ga.prototype[e]=t},Ga.defineDocExtension=function(e,t){Ml.prototype[e]=t},Ga.fromTextArea=cs,hs(Ga),Ga.version="5.65.21",Ga})},74806:function(e,t,n){(function(e){e(n(15237))})(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=t(["and","or","not","is"]),r=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in","False","True"],i=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function o(e){return e.scopes[e.scopes.length-1]}e.registerHelper("hintWords","python",r.concat(i).concat(["exec","print"])),e.defineMode("python",function(l,a){for(var s="error",u=a.delimiters||a.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,c=[a.singleOperators,a.doubleOperators,a.doubleDelimiters,a.tripleDelimiters,a.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],h=0;h<c.length;h++)c[h]||c.splice(h--,1);var f=a.hangingIndent||l.indentUnit,d=r,p=i;void 0!=a.extra_keywords&&(d=d.concat(a.extra_keywords)),void 0!=a.extra_builtins&&(p=p.concat(a.extra_builtins));var g=!(a.version&&Number(a.version)<3);if(g){var v=a.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;d=d.concat(["nonlocal","None","aiter","anext","async","await","breakpoint","match","case"]),p=p.concat(["ascii","bytes","exec","print"]);var m=new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))","i")}else{v=a.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;d=d.concat(["exec","print"]),p=p.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","None"]);m=new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var y=t(d),b=t(p);function w(e,t){var n=e.sol()&&"\\"!=t.lastToken;if(n&&(t.indent=e.indentation()),n&&"py"==o(t).type){var r=o(t).offset;if(e.eatSpace()){var i=e.indentation();return i>r?k(t):i<r&&T(e,t)&&"#"!=e.peek()&&(t.errorToken=!0),null}var l=x(e,t);return r>0&&T(e,t)&&(l+=" "+s),l}return x(e,t)}function x(e,t,r){if(e.eatSpace())return null;if(!r&&e.match(/^#.*/))return"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^[\d_]+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f_]+/i)&&(o=!0),e.match(/^0b[01_]+/i)&&(o=!0),e.match(/^0o[0-7_]+/i)&&(o=!0),e.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}if(e.match(m)){var l=-1!==e.current().toLowerCase().indexOf("f");return l?(t.tokenize=C(e.current(),t.tokenize),t.tokenize(e,t)):(t.tokenize=S(e.current(),t.tokenize),t.tokenize(e,t))}for(var a=0;a<c.length;a++)if(e.match(c[a]))return"operator";return e.match(u)?"punctuation":"."==t.lastToken&&e.match(v)?"property":e.match(y)||e.match(n)?"keyword":e.match(b)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(v)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),r?null:s)}function C(e,t){while("rubf".indexOf(e.charAt(0).toLowerCase())>=0)e=e.substr(1);var n=1==e.length,r="string";function i(e){return function(t,n){var r=x(t,n,!0);return"punctuation"==r&&("{"==t.current()?n.tokenize=i(e+1):"}"==t.current()&&(n.tokenize=e>1?i(e-1):o)),r}}function o(o,l){while(!o.eol())if(o.eatWhile(/[^'"\{\}\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return r}else{if(o.match(e))return l.tokenize=t,r;if(o.match("{{"))return r;if(o.match("{",!1))return l.tokenize=i(0),o.current()?r:l.tokenize(o,l);if(o.match("}}"))return r;if(o.match("}"))return s;o.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return s;l.tokenize=t}return r}return o.isString=!0,o}function S(e,t){while("rubf".indexOf(e.charAt(0).toLowerCase())>=0)e=e.substr(1);var n=1==e.length,r="string";function i(i,o){while(!i.eol())if(i.eatWhile(/[^'"\\]/),i.eat("\\")){if(i.next(),n&&i.eol())return r}else{if(i.match(e))return o.tokenize=t,r;i.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return s;o.tokenize=t}return r}return i.isString=!0,i}function k(e){while("py"!=o(e).type)e.scopes.pop();e.scopes.push({offset:o(e).offset+l.indentUnit,type:"py",align:null})}function L(e,t,n){var r=e.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+f,type:n,align:r})}function T(e,t){var n=e.indentation();while(t.scopes.length>1&&o(t).offset>n){if("py"!=o(t).type)return!0;t.scopes.pop()}return o(t).offset!=n}function M(e,t){e.sol()&&(t.beginningOfLine=!0,t.dedent=!1);var n=t.tokenize(e,t),r=e.current();if(t.beginningOfLine&&"@"==r)return e.match(v,!1)?"meta":g?"operator":s;if(/\S/.test(r)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=r&&"return"!=r||(t.dedent=!0),"lambda"==r&&(t.lambda=!0),":"==r&&!t.lambda&&"py"==o(t).type&&e.match(/^\s*(?:#|$)/,!1)&&k(t),1==r.length&&!/string|comment/.test(n)){var i="[({".indexOf(r);if(-1!=i&&L(e,t,"])}".slice(i,i+1)),i="])}".indexOf(r),-1!=i){if(o(t).type!=r)return s;t.indent=t.scopes.pop().offset-f}}return t.dedent&&e.eol()&&"py"==o(t).type&&t.scopes.length>1&&t.scopes.pop(),n}var N={startState:function(e){return{tokenize:w,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var r=M(e,t);return r&&"comment"!=r&&(t.lastToken="keyword"==r||"punctuation"==r?e.current():r),"punctuation"==r&&(r=null),e.eol()&&t.lambda&&(t.lambda=!1),n?r+" "+s:r},indent:function(t,n){if(t.tokenize!=w)return t.tokenize.isString?e.Pass:0;var r=o(t),i=r.type==n.charAt(0)||"py"==r.type&&!t.dedent&&/^(else:|elif |except |finally:)/.test(n);return null!=r.align?r.align-(i?1:0):r.offset-(i?f:0)},electricInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return N}),e.defineMIME("text/x-python","python");var l=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:l("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")})})}}]);